mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-17 03:14:46 +00:00
14 lines
381 B
TypeScript
14 lines
381 B
TypeScript
|
import { defineNuxtPlugin } from '#app/nuxt'
|
||
|
|
||
|
export default defineNuxtPlugin((nuxtApp) => {
|
||
|
nuxtApp.hook('app:mounted', () => {
|
||
|
try {
|
||
|
const state = sessionStorage.getItem('nuxt:reload:state')
|
||
|
if (state) {
|
||
|
sessionStorage.removeItem('nuxt:reload:state')
|
||
|
Object.assign(nuxtApp.payload.state, JSON.parse(state)?.state)
|
||
|
}
|
||
|
} catch {}
|
||
|
})
|
||
|
})
|