Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
16 lines
683 B
TypeScript
16 lines
683 B
TypeScript
export const ACCOUNT_SUSPENSION_STORAGE_KEY = 'accountSuspended'
|
|
export const ACCOUNT_SUSPENSION_CHANGED_EVENT = 'accountSuspensionChanged'
|
|
|
|
const isClient = () => typeof window !== 'undefined'
|
|
|
|
export const isAccountSuspended = (): boolean => isClient() && window.localStorage.getItem(ACCOUNT_SUSPENSION_STORAGE_KEY) === 'true'
|
|
|
|
export const setAccountSuspended = (suspended: boolean): void => {
|
|
if (!isClient()) return
|
|
|
|
if (suspended) window.localStorage.setItem(ACCOUNT_SUSPENSION_STORAGE_KEY, 'true')
|
|
else window.localStorage.removeItem(ACCOUNT_SUSPENSION_STORAGE_KEY)
|
|
|
|
window.dispatchEvent(new CustomEvent(ACCOUNT_SUSPENSION_CHANGED_EVENT, { detail: { suspended } }))
|
|
}
|