mirror of
https://github.com/get-drexa/drive.git
synced 2026-02-02 16:31:17 +00:00
fix: pass include=path when creating dir
This commit is contained in:
@@ -88,13 +88,17 @@ export const createDirectoryMutationAtom = atom((get) => {
|
||||
return mutationOptions({
|
||||
mutationFn: async (data: { name: string; parentId: string }) => {
|
||||
if (!account) throw new Error("No account selected")
|
||||
return fetchApi("POST", `/accounts/${account.id}/directories`, {
|
||||
body: JSON.stringify({
|
||||
name: data.name,
|
||||
parentId: data.parentId,
|
||||
}),
|
||||
returns: DirectoryInfoWithPath,
|
||||
}).then(([_, result]) => result)
|
||||
return fetchApi(
|
||||
"POST",
|
||||
`/accounts/${account.id}/directories?include=path`,
|
||||
{
|
||||
body: JSON.stringify({
|
||||
name: data.name,
|
||||
parentId: data.parentId,
|
||||
}),
|
||||
returns: DirectoryInfoWithPath,
|
||||
},
|
||||
).then(([_, result]) => result)
|
||||
},
|
||||
onSuccess: (data, _variables, _context, { client }) => {
|
||||
client.setQueryData(
|
||||
|
||||
Reference in New Issue
Block a user