diff --git a/src/views/Admin/RemoveList/index.tsx b/src/views/Admin/RemoveList/index.tsx index fa79187..de5e5b9 100644 --- a/src/views/Admin/RemoveList/index.tsx +++ b/src/views/Admin/RemoveList/index.tsx @@ -1,4 +1,5 @@ import React, { Dispatch, SetStateAction, useEffect, useState } from 'react'; +import { useHistory } from 'react-router-dom'; import { IData, ILoadingState } from '../../../types'; import { fetchCardList } from '../../../utils'; @@ -16,6 +17,14 @@ const RemoveList: React.FC = ({ setLoading, token, setToken }) => { const [data, setData] = useState([]); useEffect(() => fetchCardList(setData), []); + const { push: historyPush } = useHistory(); + + useEffect(() => { + if (!token) { + historyPush('/a/l'); + } + }, [setLoading, historyPush, token]); + return (
{data.map((el, index) => (