forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsign-out.js
More file actions
28 lines (26 loc) · 753 Bytes
/
Copy pathsign-out.js
File metadata and controls
28 lines (26 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { t } from '@lingui/macro'
import { GraphQLString } from 'graphql'
import { mutationWithClientMutationId } from 'graphql-relay'
export const signOut = new mutationWithClientMutationId({
name: 'SignOut',
description:
'This mutation allows a user to sign out, and clear their cookies.',
outputFields: () => ({
status: {
type: GraphQLString,
description: 'Status of the users signing-out.',
resolve: ({ status }) => status,
},
}),
mutateAndGetPayload: async (_, { i18n, response }) => {
response.cookie('refresh_token', '', {
httpOnly: true,
expires: new Date(0),
secure: true,
sameSite: true,
})
return {
status: i18n._(t`Successfully signed out.`),
}
},
})