fix: pass include=path when creating dir

This commit is contained in:
2025-12-15 22:45:05 +00:00
parent 23d9b2fefe
commit 06373404b2

View File

@@ -88,13 +88,17 @@ export const createDirectoryMutationAtom = atom((get) => {
return mutationOptions({ return mutationOptions({
mutationFn: async (data: { name: string; parentId: string }) => { mutationFn: async (data: { name: string; parentId: string }) => {
if (!account) throw new Error("No account selected") if (!account) throw new Error("No account selected")
return fetchApi("POST", `/accounts/${account.id}/directories`, { return fetchApi(
"POST",
`/accounts/${account.id}/directories?include=path`,
{
body: JSON.stringify({ body: JSON.stringify({
name: data.name, name: data.name,
parentId: data.parentId, parentId: data.parentId,
}), }),
returns: DirectoryInfoWithPath, returns: DirectoryInfoWithPath,
}).then(([_, result]) => result) },
).then(([_, result]) => result)
}, },
onSuccess: (data, _variables, _context, { client }) => { onSuccess: (data, _variables, _context, { client }) => {
client.setQueryData( client.setQueryData(