Closed LouisEiermann closed 1 week ago
To add to this: Right now the PWA doesn't have any other way to detect if the customer/user is logged in, so this API call is done every time. If there was something to detect if the user is logged in beforehand (e.g. a seperate cookie), the API call could only be done when necessary (= customer is logged in). This would accumulated save tons of API requests, expecially on sites with bigger traffic numbers and therefore relieve the load on the shopware backend.
@elkmod is there possibly any news on this issue?
What happened?
api-client.js calls refreshUser() method when initially loading the page or switching tabs. This seems to happen on every route.
https://github.com/vuestorefront/shopware-pwa/blob/master/packages/nuxt-module/plugins/api-client.js#L120
That leads to a 403 response in the console. The error message says "Customer is not logged in." which may be misleading. For example: it happens even when a new user that opens the page for the first time can not possibly be logged in.
Steps To Reproduce
Open the front page for the first time or reload it, open the console and look for a /store-api/account/customer request 403
Is there an existing issue for this?
Version
Latest stable (generated by CLI)
Which element is affected?
plugins, nuxt-module
Environment
Relevant log output