mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 18:51:11 +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
|
||||
}
|
||||
|
||||
// server asks for "rootDocId" but client has "rootDoc_id"
|
||||
type ProjectSettingsRequestBody = Partial<
|
||||
Omit<ProjectSettingsScope, 'rootDoc_id'> & {
|
||||
rootDocId: string
|
||||
}
|
||||
>
|
||||
|
||||
export const saveProjectSettings = async (
|
||||
projectId: string,
|
||||
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`, {
|
||||
body: {
|
||||
_csrf: window.csrfToken,
|
||||
...data,
|
||||
...reqData,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue