nuxt-modules / apollo

Nuxt.js module to use Vue-Apollo. The Apollo integration for GraphQL.
https://apollo.nuxtjs.org
MIT License
943 stars 198 forks source link

Cookies are not removed on the server #264

Open HaNdTriX opened 4 years ago

HaNdTriX commented 4 years ago

Description

@nuxtjs/apollo uses universal-cookie this module can read cookies but afaik it doen't modify the res. So it can't remove the cookie.

res.setHeader('Set-Cookie', ['token=deleted; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT']);

This means onLogout and onLogin have issues when they are beeing called on the server.

Code

This question is available on Nuxt community (#c247)

@kieusonlam what do you think?

ghost commented 4 years ago

This issue as been imported as question since it does not respect apollo-module issue template. Only bug reports and feature requests stays open to reduce maintainers workload. If your issue is not a question, please mention the repo admin or moderator to change its type and it will be re-opened automatically. Your question is available at https://cmty.app/nuxt/apollo-module/issues/c247.

kieusonlam commented 4 years ago

@HaNdTriX sorry for super slow response. I'm afraid so, universal-cookie doesn't modify the res on server side, then we have to manual handle where apolloHeplers function should be running. But I think it's not hard to manage that, asyncData created or middleware on Nuxt, they're running on both server sided and client side.

I used to use another package call cookie-universal but it's have some problem can't be solve. https://github.com/nuxt-community/apollo-module/issues/243