fix: i18n hydration on dev

This commit is contained in:
三咲智子 Kevin Deng 2023-01-15 23:15:03 +08:00
parent f96a9417da
commit 6b90131783
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
2 changed files with 6 additions and 13 deletions

View file

@ -10,8 +10,7 @@ export default defineNuxtPlugin(() => {
{
innerHTML: `
;(function() {
const handle = localStorage.getItem('${STORAGE_KEY_CURRENT_USER_HANDLE}')
if (!handle) { return }
const handle = localStorage.getItem('${STORAGE_KEY_CURRENT_USER_HANDLE}') || '[anonymous]'
const allSettings = JSON.parse(localStorage.getItem('${STORAGE_KEY_SETTINGS}') || '{}')
const settings = allSettings[handle]
if (!settings) { return }