mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-04 19:09:29 +00:00
Refac take searchParams from router in Base.tsx
This commit is contained in:
@@ -36,6 +36,7 @@ export type OutletContextType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Base = () => {
|
const Base = () => {
|
||||||
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const { setAuth } = useAuthStore();
|
const { setAuth } = useAuthStore();
|
||||||
const { setUserConfig } = useUserConfigStore();
|
const { setUserConfig } = useUserConfigStore();
|
||||||
const { setUserAccount } = useUserAccountStore();
|
const { setUserAccount } = useUserAccountStore();
|
||||||
@@ -45,12 +46,9 @@ const Base = () => {
|
|||||||
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
const searchParams = new URLSearchParams(location.search);
|
|
||||||
|
|
||||||
const currentPageFromUrl = Number(searchParams.get('page'));
|
const currentPageFromUrl = Number(searchParams.get('page'));
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(currentPageFromUrl);
|
const [currentPage, setCurrentPage] = useState(currentPageFromUrl);
|
||||||
const [, setSearchParams] = useSearchParams();
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setAuth(auth);
|
setAuth(auth);
|
||||||
|
|||||||
Reference in New Issue
Block a user