chore: store pagination for list
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { getDefaultStore } from 'jotai';
|
||||
import { atomWithStorage } from 'jotai/utils';
|
||||
|
||||
export interface PaginationState {
|
||||
perPage: number;
|
||||
}
|
||||
|
||||
export const paginationAtom = atomWithStorage<Record<string, any>>(
|
||||
'paginationStatus',
|
||||
{},
|
||||
undefined,
|
||||
{ getOnInit: true }
|
||||
);
|
||||
|
||||
export const getPaginationStatus = (key: string) => {
|
||||
if (!key) return {};
|
||||
const store = getDefaultStore();
|
||||
const cache = store.get(paginationAtom);
|
||||
return cache[key] || {};
|
||||
};
|
||||
Reference in New Issue
Block a user