-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: revert pull-request #255, and use invalidateStore instead * move config to logout.mutation Co-authored-by: Seyyed Morteza Moosavi <smmoosavi@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
38 additions
and
74 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
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
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 |
---|---|---|
@@ -1,15 +1,24 @@ | ||
import graphql from 'babel-plugin-relay/macro'; | ||
import { useCallback } from 'react'; | ||
import { useMutation } from 'src/relay'; | ||
|
||
export const useLogoutMutation = () => | ||
useMutation(graphql` | ||
mutation logoutMutation($input: LogoutMutationInput!) { | ||
logout(input: $input) { | ||
viewer { | ||
me { | ||
...AuthGuard_user | ||
} | ||
import { logoutMutation } from './__generated__/logoutMutation.graphql'; | ||
|
||
const mutation = graphql` | ||
mutation logoutMutation($input: LogoutMutationInput!) { | ||
logout(input: $input) { | ||
viewer { | ||
me { | ||
...AuthGuard_user | ||
} | ||
} | ||
} | ||
`); | ||
} | ||
`; | ||
|
||
export const useLogoutMutation = () => { | ||
const logout = useMutation<logoutMutation>(mutation); | ||
return useCallback(() => { | ||
logout({ input: {} }, { updater: (store) => store.invalidateStore() }); | ||
}, [logout]); | ||
}; |
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,12 @@ | ||
import 'relay-runtime'; | ||
|
||
declare module 'relay-runtime' { | ||
interface RecordSourceSelectorProxy { | ||
/** | ||
* Globally invalidates the Relay store. This will cause any data that was written to the store before invalidation occurred to be | ||
* considered stale, and will be considered to require refetch the next time a query is | ||
* checked with `environment.check()`. | ||
*/ | ||
invalidateStore(): void; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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 |
---|---|---|
@@ -1,7 +1,3 @@ | ||
export { commitMutation } from './helpers/commitMutation'; | ||
export { useMutation } from './helpers/useMutation'; | ||
export { | ||
RelayEnvironmnetContextProvider, | ||
useRelayEnvironmentReset, | ||
RelayEnvironmentResetContext, | ||
} from './RelayEnvironmentContext'; | ||
export { environment } from './environments'; |
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