-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: sync LMS_BASE_URL for bookmark API if changed
This change makes it possible to use the latest LMS_BASE_API if it was changed because of dynamic config API, which is the default case of tutor. This changes closes openedx/wg-build-test-release/issues/270 Fixes that are simlar to this - gradebook openedx/frontend-app-gradebook/pull/290 - course authoring openedx/frontend-app-authoring/pull/389
- Loading branch information
1 parent
757d967
commit 2213d45
Showing
2 changed files
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { getConfig } from '@edx/frontend-platform'; | ||
import { getAuthenticatedHttpClient, getAuthenticatedUser } from '@edx/frontend-platform/auth'; | ||
|
||
const bookmarksBaseUrl = `${getConfig().LMS_BASE_URL}/api/bookmarks/v1/bookmarks/`; | ||
export const getBookmarksBaseUrl = () => `${getConfig().LMS_BASE_URL}/api/bookmarks/v1/bookmarks/`; | ||
|
||
export async function createBookmark(usageId) { | ||
return getAuthenticatedHttpClient().post(bookmarksBaseUrl, { usage_id: usageId }); | ||
return getAuthenticatedHttpClient().post(getBookmarksBaseUrl(), { usage_id: usageId }); | ||
} | ||
|
||
export async function deleteBookmark(usageId) { | ||
const { username } = getAuthenticatedUser(); | ||
return getAuthenticatedHttpClient().delete(`${bookmarksBaseUrl}${username},${usageId}/`); | ||
return getAuthenticatedHttpClient().delete(`${getBookmarksBaseUrl()}${username},${usageId}/`); | ||
} |