Skip to content

Commit

Permalink
fix(nuxt): early return from refreshCookie on server
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Mar 21, 2024
1 parent cca81bc commit 22ada37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/nuxt/src/app/composables/cookie.ts
Expand Up @@ -132,7 +132,7 @@ export function useCookie<T = string | null | undefined> (name: string, _opts?:
}
/** @since 3.10.0 */
export function refreshCookie (name: string) {
if (store || typeof BroadcastChannel === 'undefined') { return }
if (import.meta.server || store || typeof BroadcastChannel === 'undefined') { return }

new BroadcastChannel(`nuxt:cookies:${name}`)?.postMessage({ refresh: true })
}
Expand Down

0 comments on commit 22ada37

Please sign in to comment.