mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-18 02:30:51 +08:00
31 lines
793 B
TypeScript
31 lines
793 B
TypeScript
export type AuthFilesUiState = {
|
|
filter?: string;
|
|
search?: string;
|
|
page?: number;
|
|
pageSize?: number;
|
|
};
|
|
|
|
const AUTH_FILES_UI_STATE_KEY = 'authFilesPage.uiState';
|
|
|
|
export const readAuthFilesUiState = (): AuthFilesUiState | null => {
|
|
if (typeof window === 'undefined') return null;
|
|
try {
|
|
const raw = window.sessionStorage.getItem(AUTH_FILES_UI_STATE_KEY);
|
|
if (!raw) return null;
|
|
const parsed = JSON.parse(raw) as AuthFilesUiState;
|
|
return parsed && typeof parsed === 'object' ? parsed : null;
|
|
} catch {
|
|
return null;
|
|
}
|
|
};
|
|
|
|
export const writeAuthFilesUiState = (state: AuthFilesUiState) => {
|
|
if (typeof window === 'undefined') return;
|
|
try {
|
|
window.sessionStorage.setItem(AUTH_FILES_UI_STATE_KEY, JSON.stringify(state));
|
|
} catch {
|
|
// ignore
|
|
}
|
|
};
|
|
|