-
Notifications
You must be signed in to change notification settings - Fork 575
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add update user interest mutation [wip]
- Loading branch information
1 parent
2732f47
commit 5e4e881
Showing
2 changed files
with
63 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/app/Scenes/MyCollection/mutations/updateUserInterest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { DeleteUserInterestMutationInput } from "__generated__/deleteUserInterestMutation.graphql" | ||
import { getRelayEnvironment } from "app/system/relay/defaultEnvironment" | ||
import { commitMutation, graphql } from "react-relay" | ||
|
||
export const updateUserInterest = (input: DeleteUserInterestMutationInput) => { | ||
return new Promise((resolve, reject) => { | ||
commitMutation(getRelayEnvironment(), { | ||
mutation: graphql` | ||
mutation updateUserInterestMutation($input: UpdateUserInterestMutationInput!) { | ||
updateUserInterest(input: $input) { | ||
userInterest { | ||
internalID | ||
} | ||
} | ||
} | ||
`, | ||
variables: { | ||
input, | ||
}, | ||
onCompleted: (response, errors) => { | ||
if (errors?.length) { | ||
reject(errors) | ||
} else { | ||
resolve(response) | ||
} | ||
}, | ||
onError: reject, | ||
}) | ||
}) | ||
} |