18 lines
508 B
TypeScript
18 lines
508 B
TypeScript
/* eslint-disable react-hooks/exhaustive-deps */
|
|
import { useEffect } from 'react';
|
|
import { useNavigate } from 'react-router';
|
|
import { StorageKeys } from '@/shared/constants/local-storage';
|
|
import useLocalStorageState from 'use-local-storage-state';
|
|
|
|
export const useRedirect = () => {
|
|
const navigate = useNavigate();
|
|
const [path, , { removeItem }] = useLocalStorageState(StorageKeys.RedirectPath);
|
|
|
|
useEffect(() => {
|
|
if(path){
|
|
// navigate(path);
|
|
removeItem();
|
|
}
|
|
}, [path]);
|
|
};
|