Skip to content

Commit

Permalink
feat: set cookie on domain
Browse files Browse the repository at this point in the history
  • Loading branch information
lego-technix committed Jan 23, 2023
1 parent 26aa2ec commit 5d14848
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/locale-observer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { config } from '../config/environment'

console.log({ domain: config.siteDomain })

export default function ({ app }) {
app.i18n.onBeforeLanguageSwitch = (oldLocale, newLocale) => {
_setLocaleCookie(newLocale)
}
}

function _setLocaleCookie(locale) {
document.cookie = `locale=${locale}; path=/; max-age=31536000`
document.cookie = `locale=${locale}; path=/; domain=${config.siteDomain}; max-age=31536000`
}

0 comments on commit 5d14848

Please sign in to comment.