import { getFromStorage, updateStorage } from "../../lib"; import { EStorageKey } from "../enums"; import { ILastSorting } from "../types"; export class Sorting { get(tableId: string): ILastSorting | undefined { const sorting = getFromStorage(EStorageKey.sorting); return sorting[tableId]; } reset(tableId: string): void { const sorting = getFromStorage(EStorageKey.sorting); sorting[tableId] = undefined; updateStorage(EStorageKey.sorting, sorting); } set(tableId: string, columnId: string | number, isAscending: boolean): void { const sorting = getFromStorage(EStorageKey.sorting); sorting[tableId] = { columnId, isAscending }; updateStorage(EStorageKey.sorting, sorting); } }