diff --git a/services/web/frontend/js/features/editor-left-menu/hooks/use-set-project-wide-settings.tsx b/services/web/frontend/js/features/editor-left-menu/hooks/use-set-project-wide-settings.tsx index 4b9255f1c5..cd4800f5c2 100644 --- a/services/web/frontend/js/features/editor-left-menu/hooks/use-set-project-wide-settings.tsx +++ b/services/web/frontend/js/features/editor-left-menu/hooks/use-set-project-wide-settings.tsx @@ -19,7 +19,7 @@ export default function useSetProjectWideSettings() { (compiler: ProjectCompiler) => { if (project?.compiler) { setProject({ ...project, compiler }) - saveProjectSettings(projectId, { compiler }) + saveProjectSettings({ projectId, compiler }) } }, [projectId, project, setProject] @@ -29,7 +29,7 @@ export default function useSetProjectWideSettings() { (imageName: string) => { if (project?.imageName) { setProject({ ...project, imageName }) - saveProjectSettings(projectId, { imageName }) + saveProjectSettings({ projectId, imageName }) } }, [projectId, project, setProject] diff --git a/services/web/frontend/js/features/editor-left-menu/hooks/use-set-root-doc-id.tsx b/services/web/frontend/js/features/editor-left-menu/hooks/use-set-root-doc-id.tsx index 33933644a6..535ea77e41 100644 --- a/services/web/frontend/js/features/editor-left-menu/hooks/use-set-root-doc-id.tsx +++ b/services/web/frontend/js/features/editor-left-menu/hooks/use-set-root-doc-id.tsx @@ -19,7 +19,7 @@ export default function useSetRootDocId() { if (!disallowChange) { try { - await saveProjectSettings(projectId, { rootDoc_id: rootDocId }) + await saveProjectSettings({ projectId, rootDoc_id: rootDocId }) setRootDocIdScope(rootDocId) } catch (err) { // TODO: retry mechanism (max 10x before failed completely and rollback the old value) diff --git a/services/web/frontend/js/features/editor-left-menu/hooks/use-set-spell-check-language.tsx b/services/web/frontend/js/features/editor-left-menu/hooks/use-set-spell-check-language.tsx index 3e57e7fc14..413c2ead6f 100644 --- a/services/web/frontend/js/features/editor-left-menu/hooks/use-set-spell-check-language.tsx +++ b/services/web/frontend/js/features/editor-left-menu/hooks/use-set-spell-check-language.tsx @@ -23,7 +23,7 @@ export default function useSetSpellCheckLanguage() { setSpellCheckLanguageScope(spellCheckLanguage) // save to both project setting and user setting - saveProjectSettings(projectId, { spellCheckLanguage }) + saveProjectSettings({ projectId, spellCheckLanguage }) saveUserSettings({ spellCheckLanguage }) } }, diff --git a/services/web/frontend/js/features/editor-left-menu/utils/api.ts b/services/web/frontend/js/features/editor-left-menu/utils/api.ts index feea512e0c..2b69359042 100644 --- a/services/web/frontend/js/features/editor-left-menu/utils/api.ts +++ b/services/web/frontend/js/features/editor-left-menu/utils/api.ts @@ -52,10 +52,14 @@ type ProjectSettingsRequestBody = Partial< } > -export const saveProjectSettings = async ( - projectId: string, - data: Partial -) => { +type SaveProjectSettings = { + projectId: string +} & Partial + +export const saveProjectSettings = async ({ + projectId, + ...data +}: SaveProjectSettings) => { let reqData: ProjectSettingsRequestBody = {} if (data.rootDoc_id) {