Skip to content

Commit 3c2643c

Browse files
committed
refactor: introduce constant for activation modal storage key
- Added a new constant for the activation code modal hidden storage key to improve code maintainability and clarity. - Updated the activation code store to utilize the new constant, replacing hardcoded string references.
1 parent 30d821a commit 3c2643c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

web/consts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const ACTIVATION_CODE_MODAL_HIDDEN_STORAGE_KEY = 'activationCodeModalHidden';

web/store/activationCode.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineStore, createPinia, setActivePinia } from 'pinia';
2+
import { ACTIVATION_CODE_MODAL_HIDDEN_STORAGE_KEY } from '~/consts';
23
import { useServerStore } from '~/store/server';
34
import { useCallbackActionsStore } from '~/store/callbackActions';
45

@@ -32,11 +33,10 @@ export const useActivationCodeStore = defineStore('activationCode', () => {
3233
const partnerUrl = computed<string | null>(() => data.value?.partnerUrl || null);
3334
const partnerLogo = computed<string | null>(() => data.value?.partnerLogo ? `/webGui/images/partner-logo.svg` : null);
3435

35-
const sessionKey = 'activationCodeModalHidden';
36-
const activationModalHidden = ref<boolean>(sessionStorage.getItem(sessionKey) === 'true');
36+
const activationModalHidden = ref<boolean>(sessionStorage.getItem(ACTIVATION_CODE_MODAL_HIDDEN_STORAGE_KEY) === 'true');
3737
const setActivationModalHidden = (value: boolean) => activationModalHidden.value = value;
3838
watch(activationModalHidden, (newVal) => {
39-
return newVal ? sessionStorage.setItem(sessionKey, 'true') : sessionStorage.removeItem(sessionKey);
39+
return newVal ? sessionStorage.setItem(ACTIVATION_CODE_MODAL_HIDDEN_STORAGE_KEY, 'true') : sessionStorage.removeItem(ACTIVATION_CODE_MODAL_HIDDEN_STORAGE_KEY);
4040
});
4141
/**
4242
* Should only see this if

0 commit comments

Comments
 (0)