mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Fix Cypress test
This commit is contained in:
parent
d0985ca804
commit
8a20b994cf
@ -22,13 +22,15 @@ export default ({ app, req, cookie, store }) => {
|
|||||||
if (process.server) return
|
if (process.server) return
|
||||||
|
|
||||||
const newLocale = mutation.payload.locale
|
const newLocale = mutation.payload.locale
|
||||||
|
let isCookie = true
|
||||||
let currentLocale = await app.$cookies.get(key)
|
let currentLocale = await app.$cookies.get(key)
|
||||||
if (!currentLocale) {
|
if (!currentLocale) {
|
||||||
|
isCookie = false
|
||||||
currentLocale = navigator.language.split('-')[0] // get browser language
|
currentLocale = navigator.language.split('-')[0] // get browser language
|
||||||
}
|
}
|
||||||
const isDifferent = newLocale !== currentLocale
|
const isDifferent = newLocale !== currentLocale
|
||||||
|
|
||||||
if (!isDifferent) {
|
if (isCookie && !isDifferent) { // cookie has to be set, otherwise Cypress test does not work
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user