Add missed ;
This commit is contained in:
@@ -31,7 +31,8 @@ axios.interceptors.response.use(
|
|||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
if (error.response && error.response.status === 401) {
|
if (error.response && error.response.status === 401) {
|
||||||
navigate('/login')
|
navigate('/login');
|
||||||
|
|
||||||
store.dispatch(setToken(''));
|
store.dispatch(setToken(''));
|
||||||
}
|
}
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const AuthLayout = () => {
|
|||||||
<Outlet />
|
<Outlet />
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default AuthLayout
|
export default AuthLayout;
|
||||||
@@ -73,7 +73,8 @@ const Profile = () => {
|
|||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
return axios.get('/profile');
|
return axios.get('/profile');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!mutation.isPending && (
|
{!mutation.isPending && (
|
||||||
|
|||||||
@@ -28,10 +28,11 @@ const ModalConfigDetails = ({
|
|||||||
maxTraffic: number | "unlimited";
|
maxTraffic: number | "unlimited";
|
||||||
traffic: number;
|
traffic: number;
|
||||||
}) => {
|
}) => {
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate();
|
||||||
const copyToClipboard = async (textToCopy: string) => {
|
const copyToClipboard = async (textToCopy: string) => {
|
||||||
try {
|
try {
|
||||||
await navigator.clipboard.writeText(textToCopy);
|
await navigator.clipboard.writeText(textToCopy);
|
||||||
|
|
||||||
toast.success("متن با موفقیت کپی شد!");
|
toast.success("متن با موفقیت کپی شد!");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toast.error(`Failed to copy: , ${err}`);
|
toast.error(`Failed to copy: , ${err}`);
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import useAxios from "../../../hooks/useAxios";
|
|||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
const Tutorials = () => {
|
const Tutorials = () => {
|
||||||
const axios = useAxios()
|
const axios = useAxios();
|
||||||
const {data,error,isLoading,isFetching} = useQuery({
|
const {data,error,isLoading,isFetching} = useQuery({
|
||||||
queryKey:["categoryLearning"],
|
queryKey:["categoryLearning"],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
return axios.get('/home/category/learning')
|
return axios.get('/home/category/learning');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
const [activeTutorial, setActiveTutorial] = useState<number>(1);
|
const [activeTutorial, setActiveTutorial] = useState<number>(1);
|
||||||
return (
|
return (
|
||||||
<div className="relative w-full h-full flex flex-col px-4 py-4 text-start">
|
<div className="relative w-full h-full flex flex-col px-4 py-4 text-start">
|
||||||
|
|||||||
@@ -8,11 +8,13 @@ const isTokenValid = (token: string): boolean => {
|
|||||||
return !!token;
|
return !!token;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Token validation error:", error);
|
console.error("Token validation error:", error);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const isAuthenticated = () : boolean => {
|
export const isAuthenticated = () : boolean => {
|
||||||
const {token} = useSelector((state : RootState) => state.token)
|
const {token} = useSelector((state : RootState) => state.token);
|
||||||
|
|
||||||
return isTokenValid(token);
|
return isTokenValid(token);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ import react from '@vitejs/plugin-react'
|
|||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
})
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user