* feat: add backup view for libraries v2 * chore: updated paths and cleanup * chore: cleanup text * chore: added test * chore: fix contracts after rebase * chore: more tests to improve coverage * chore: more test for coverage * chore: more test for coverage * chore: fixed lint issues * chore: update naming for a more semantic one * chore: changed fireEvent to userEvent * chore: improved queryKeys * chore: lint cleanup * chore: changed tests and time to 1min * chore: even more tests * chore: split hook for library menu items * chore: fixed typo on refactor * chore: improved test to use available mocks * chore: change from jest.mocks to spyon * chore: update test based on commets * chore: update test to get URL from a better place * chore: added extra getters for new endpoints * chore: update test to prevent issues with useContentLibrary * chore: added comments for clarity * chore: lint fix * chore: updated url handle to use full URL * chore: linting fixes
15 lines
785 B
TypeScript
15 lines
785 B
TypeScript
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
|
|
import { CreateLibraryBackupResponse, GetLibraryBackupStatusResponse } from '@src/library-authoring/backup-restore/data/constants';
|
|
import { getLibraryBackupApiUrl, getLibraryBackupStatusApiUrl } from '@src/library-authoring/data/api';
|
|
|
|
export const createLibraryBackup = async (libraryId: string): Promise<CreateLibraryBackupResponse> => {
|
|
const { data } = await getAuthenticatedHttpClient().post(getLibraryBackupApiUrl(libraryId), {});
|
|
return data;
|
|
};
|
|
|
|
export const getLibraryBackupStatus = async (libraryId: string, taskId: string):
|
|
Promise<GetLibraryBackupStatusResponse> => {
|
|
const { data } = await getAuthenticatedHttpClient().get(getLibraryBackupStatusApiUrl(libraryId, taskId));
|
|
return data;
|
|
};
|