mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
replace useLocalStorage
This commit is contained in:
parent
cb7ff9372e
commit
a5094b1fc0
@ -1,9 +1,9 @@
|
|||||||
import { useFeaturesArchive } from '../../hooks/api/getters/useFeaturesArchive/useFeaturesArchive';
|
import { useFeaturesArchive } from '../../hooks/api/getters/useFeaturesArchive/useFeaturesArchive';
|
||||||
import { ArchiveTable } from './ArchiveTable/ArchiveTable';
|
import { ArchiveTable } from './ArchiveTable/ArchiveTable';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
||||||
import { SortingRule } from 'react-table';
|
import { SortingRule } from 'react-table';
|
||||||
import { usePageTitle } from '../../hooks/usePageTitle';
|
import { usePageTitle } from 'hooks/usePageTitle';
|
||||||
|
import { createLocalStorage } from 'utils/createLocalStorage';
|
||||||
|
|
||||||
const defaultSort: SortingRule<string> = { id: 'createdAt', desc: true };
|
const defaultSort: SortingRule<string> = { id: 'createdAt', desc: true };
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ export const FeaturesArchiveTable = () => {
|
|||||||
} = useFeaturesArchive();
|
} = useFeaturesArchive();
|
||||||
|
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const [storedParams, setStoredParams] = useLocalStorage(
|
const { value, setValue } = createLocalStorage(
|
||||||
'FeaturesArchiveTable:v1',
|
'FeaturesArchiveTable:v1',
|
||||||
defaultSort
|
defaultSort
|
||||||
);
|
);
|
||||||
@ -28,8 +28,8 @@ export const FeaturesArchiveTable = () => {
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
searchParams={searchParams}
|
searchParams={searchParams}
|
||||||
setSearchParams={setSearchParams}
|
setSearchParams={setSearchParams}
|
||||||
storedParams={storedParams}
|
storedParams={value}
|
||||||
setStoredParams={setStoredParams}
|
setStoredParams={setValue}
|
||||||
refetch={refetchArchived}
|
refetch={refetchArchived}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { ArchiveTable } from './ArchiveTable/ArchiveTable';
|
import { ArchiveTable } from './ArchiveTable/ArchiveTable';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
||||||
import { SortingRule } from 'react-table';
|
import { SortingRule } from 'react-table';
|
||||||
import { useProjectFeaturesArchive } from '../../hooks/api/getters/useProjectFeaturesArchive/useProjectFeaturesArchive';
|
import { useProjectFeaturesArchive } from '../../hooks/api/getters/useProjectFeaturesArchive/useProjectFeaturesArchive';
|
||||||
|
import { createLocalStorage } from 'utils/createLocalStorage';
|
||||||
|
|
||||||
const defaultSort: SortingRule<string> = { id: 'archivedAt', desc: true };
|
const defaultSort: SortingRule<string> = { id: 'archivedAt', desc: true };
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ export const ProjectFeaturesArchiveTable = ({
|
|||||||
} = useProjectFeaturesArchive(projectId);
|
} = useProjectFeaturesArchive(projectId);
|
||||||
|
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const [storedParams, setStoredParams] = useLocalStorage(
|
const { value, setValue } = createLocalStorage(
|
||||||
`${projectId}:ProjectFeaturesArchiveTable`,
|
`${projectId}:ProjectFeaturesArchiveTable`,
|
||||||
defaultSort
|
defaultSort
|
||||||
);
|
);
|
||||||
@ -32,8 +32,8 @@ export const ProjectFeaturesArchiveTable = ({
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
searchParams={searchParams}
|
searchParams={searchParams}
|
||||||
setSearchParams={setSearchParams}
|
setSearchParams={setSearchParams}
|
||||||
storedParams={storedParams}
|
storedParams={value}
|
||||||
setStoredParams={setStoredParams}
|
setStoredParams={setValue}
|
||||||
refetch={refetchArchived}
|
refetch={refetchArchived}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user