mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 19:02:07 +00:00
Rename "rootDoc_id" to "rootDocId" before sending it to server
GitOrigin-RevId: fc29e152ffd3bf97c00ee817abb07086f6cdfe17
This commit is contained in:
parent
30c32713c6
commit
b6b6b9c4b1
1 changed files with 21 additions and 1 deletions
|
@ -39,14 +39,34 @@ export type ProjectSettingsScope = {
|
||||||
spellCheckLanguage: string
|
spellCheckLanguage: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// server asks for "rootDocId" but client has "rootDoc_id"
|
||||||
|
type ProjectSettingsRequestBody = Partial<
|
||||||
|
Omit<ProjectSettingsScope, 'rootDoc_id'> & {
|
||||||
|
rootDocId: string
|
||||||
|
}
|
||||||
|
>
|
||||||
|
|
||||||
export const saveProjectSettings = async (
|
export const saveProjectSettings = async (
|
||||||
projectId: string,
|
projectId: string,
|
||||||
data: Partial<ProjectSettingsScope>
|
data: Partial<ProjectSettingsScope>
|
||||||
) => {
|
) => {
|
||||||
|
let reqData: ProjectSettingsRequestBody = {}
|
||||||
|
|
||||||
|
if (data.rootDoc_id) {
|
||||||
|
const val = data.rootDoc_id
|
||||||
|
delete data.rootDoc_id
|
||||||
|
reqData = {
|
||||||
|
...data,
|
||||||
|
rootDocId: val,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reqData = data
|
||||||
|
}
|
||||||
|
|
||||||
await postJSON<never>(`/project/${projectId}/settings`, {
|
await postJSON<never>(`/project/${projectId}/settings`, {
|
||||||
body: {
|
body: {
|
||||||
_csrf: window.csrfToken,
|
_csrf: window.csrfToken,
|
||||||
...data,
|
...reqData,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue