How can i add axios default header in Quasar ^2.0.0
shahriar350 opened this issue · comments
I think
import { Cookies } from 'quasar'
Cookies.get(...
in server side rendering you cannot access the user's browser's cookies.
Think about it... how can the server know what cookies live in the browser?
The whole idea about SSR is that the server tries to create the UI before that UI is sent to the browser.
So now, what is the solution because I need to sent csrf token which in my cookie. I use Django as backend. Without csrftoken, Django rejected the connection.
in server side rendering you cannot access the user's browser's cookies.
Think about it... how can the server know what cookies live in the browser?
The whole idea about SSR is that the server tries to create the UI before that UI is sent to the browser.
Now it is ok. i use js-cookie package and proxy.
The cookies are sent through HTTP headers. So Cookies plugin can handle cookies server-side too.
https://quasar.dev/quasar-plugins/cookies#Notes-on-SSR
Put that in the default exporting function (where you have access to the ssrContext).