mirror of
https://github.com/mediacms-io/mediacms.git
synced 2026-03-10 15:07:23 -04:00
a few
This commit is contained in:
@@ -49,33 +49,3 @@ export function getLtiContextId(): string | null {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function associateMediaWithLtiCategory(mediaId: string): void {
|
||||
const ltiContextId = getLtiContextId();
|
||||
|
||||
if (!ltiContextId || !mediaId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const csrfMatch = document.cookie.match(/(?:^|;\s*)csrftoken=([^;]+)/);
|
||||
const csrfToken = csrfMatch ? csrfMatch[1] : '';
|
||||
|
||||
fetch('/api/v1/media/user/bulk_actions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
action: 'add_to_category',
|
||||
media_ids: [mediaId],
|
||||
lti_context_id: ltiContextId,
|
||||
}),
|
||||
}).then(response => {
|
||||
if (!response.ok) {
|
||||
console.warn('[MediaCMS LTI] Failed to associate media with course category:', response.statusText);
|
||||
}
|
||||
}).catch(error => {
|
||||
console.warn('[MediaCMS LTI] Failed to associate media with course category:', error);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -14,4 +14,4 @@ export * from './quickSort';
|
||||
export * from './requests';
|
||||
export { translateString } from './translate';
|
||||
export { replaceString } from './replacementStrings';
|
||||
export { inEmbeddedApp, inSelectMediaEmbedMode, isSelectMediaMode, associateMediaWithLtiCategory } from './embeddedApp';
|
||||
export { inEmbeddedApp, inSelectMediaEmbedMode, isSelectMediaMode } from './embeddedApp';
|
||||
|
||||
Reference in New Issue
Block a user