From 4038fd4d4a72e1f372f85986217123701df599a4 Mon Sep 17 00:00:00 2001 From: Lautaro Bustos Date: Wed, 27 Mar 2024 14:05:23 -0300 Subject: [PATCH] fix: condition for gatsby build (#605) * fix: condition for gatsby build * fix: remove pack --- src/modules/notifications.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/modules/notifications.ts b/src/modules/notifications.ts index 95bd5ced..e7a4cc20 100644 --- a/src/modules/notifications.ts +++ b/src/modules/notifications.ts @@ -42,18 +42,22 @@ export class NotificationsAPI extends BaseClient { const ONBOARDING_KEY = "dcl_notifications_onboarding" export const checkIsOnboarding = () => { - const isOnboarding = localStorage.getItem(ONBOARDING_KEY) - if (isOnboarding) { - const value = JSON.parse(isOnboarding) - return value - } else { - localStorage.setItem(ONBOARDING_KEY, "true") - return true + if (typeof window !== "undefined") { + const isOnboarding = localStorage.getItem(ONBOARDING_KEY) + if (isOnboarding) { + const value = JSON.parse(isOnboarding) + return value + } else { + localStorage.setItem(ONBOARDING_KEY, "true") + return true + } } } export const setOnboardingDone = () => { - localStorage.setItem(ONBOARDING_KEY, "false") + if (typeof window !== "undefined") { + localStorage.setItem(ONBOARDING_KEY, "false") + } } const parseNotification = (notification: DCLNotification): DCLNotification => {