Skip to content

Commit

Permalink
[Fix] No guardian on delete (#297)
Browse files Browse the repository at this point in the history
* [Fix] No guardian on delete

* Change delete to disconnect
  • Loading branch information
leogjhuang committed Jul 30, 2023
1 parent 0b520fa commit 3452442
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
8 changes: 6 additions & 2 deletions lib/application-processing/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export const completeApplication: Resolver<
},
},
},
// If guardian information given, upsert. Otherwise, delete (SET NULL)
// If guardian information given, upsert.
...(guardian
? {
guardian: {
Expand All @@ -331,7 +331,11 @@ export const completeApplication: Resolver<
},
},
}
: { guardian: { delete: true } }),
: {
guardian: {
disconnect: true,
},
}),
},
});

Expand Down
15 changes: 6 additions & 9 deletions tools/hooks/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,12 @@ const useMutation = <
onCompleted: data => {
for (const key in data) {
const result = data[key] as unknown as { ok: boolean; error?: string };
if ('ok' in result && 'error' in result) {
if (!result.ok) {
toast({
status: 'error',
description: result.error,
isClosable: true,
});
}
}
if (result.ok) continue;
toast({
status: 'error',
description: result.error,
isClosable: true,
});
}
options?.onCompleted && options.onCompleted(data);
},
Expand Down

0 comments on commit 3452442

Please sign in to comment.