Skip to content

Commit

Permalink
added domain field to clearCookie
Browse files Browse the repository at this point in the history
  • Loading branch information
aseerkt committed May 12, 2021
1 parent a93d651 commit 037449d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/src/resolvers/UserResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ import {
RegisterVars,
} from '../types/userTypes';
import { formatErrors } from '../utils/formatErrors';
import { COOKIE_NAME, __prod__ } from '../constants';
import { COOKIE_NAME, EXPRESS_ENDPOINT, __prod__ } from '../constants';
import { Profile } from '../entities/Profile';
import { Post } from '../entities/Post';
import { createTokenCookie } from '../utils/tokenHandler';
import { isUser } from '../middlewares/isUser';
import { isAuth } from '../middlewares/isAuth';
import { extractDomainFromUrl } from '../utils/extractDomainFromUrl';

@Resolver(User)
export class UserResolver {
Expand Down Expand Up @@ -139,6 +140,7 @@ export class UserResolver {
logout(@Ctx() { res }: MyContext) {
return new Promise((resolve) => {
res.clearCookie(COOKIE_NAME, {
domain: extractDomainFromUrl(EXPRESS_ENDPOINT),
sameSite: __prod__ ? 'none' : 'lax',
secure: __prod__,
});
Expand Down

1 comment on commit 037449d

@vercel
Copy link

@vercel vercel bot commented on 037449d May 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.