mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
Better use mutations
This commit is contained in:
parent
092cec26f4
commit
86ae9d6959
1 changed files with 10 additions and 0 deletions
|
@ -44,6 +44,11 @@ const updateMutation = {
|
|||
const { Users, currentUser } = context;
|
||||
|
||||
const document = await Connectors.get(Users, selector);
|
||||
|
||||
if (!document) {
|
||||
throw new Error(`Could not find document to update for selector: ${JSON.stringify(selector)}`);
|
||||
}
|
||||
|
||||
performCheck(this, currentUser, document);
|
||||
|
||||
return updateMutator({
|
||||
|
@ -71,6 +76,11 @@ const deleteMutation = {
|
|||
const { Users, currentUser } = context;
|
||||
|
||||
const document = await Connectors.get(Users, selector);
|
||||
|
||||
if (!document) {
|
||||
throw new Error(`Could not find document to delete for selector: ${JSON.stringify(selector)}`);
|
||||
}
|
||||
|
||||
performCheck(this, currentUser, document);
|
||||
|
||||
return deleteMutator({
|
||||
|
|
Loading…
Add table
Reference in a new issue