2023-03-02 19:45:19 +00:00
|
|
|
import { refreshableSettings, createPersistedStore } from '@@/datatables/types';
|
|
|
|
|
2023-09-20 06:04:26 +00:00
|
|
|
import { TableSettings } from './DefaultDatatableSettings';
|
|
|
|
import { systemResourcesSettings } from './SystemResourcesSettings';
|
2023-03-02 19:45:19 +00:00
|
|
|
|
2023-08-13 17:09:40 +00:00
|
|
|
export function createStore(
|
|
|
|
storageKey: string,
|
|
|
|
initialSortBy: string | { id: string; desc: boolean } = 'name'
|
|
|
|
) {
|
|
|
|
return createPersistedStore<TableSettings>(
|
|
|
|
storageKey,
|
|
|
|
initialSortBy,
|
|
|
|
(set) => ({
|
|
|
|
...refreshableSettings(set),
|
|
|
|
...systemResourcesSettings(set),
|
|
|
|
})
|
|
|
|
);
|
2023-03-02 19:45:19 +00:00
|
|
|
}
|