refresh token
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ declare global {
|
|||||||
const queryClient = new QueryClient({
|
const queryClient = new QueryClient({
|
||||||
queryCache: new QueryCache({
|
queryCache: new QueryCache({
|
||||||
onError: async (error: IApiErrorRepsonse) => {
|
onError: async (error: IApiErrorRepsonse) => {
|
||||||
if (error?.response?.statusCode === 401) {
|
if (error?.response?.status === 401) {
|
||||||
// اگر refresh token منقضی شده باشد، دیگر تلاش نکن
|
// اگر refresh token منقضی شده باشد، دیگر تلاش نکن
|
||||||
if (window.isRefreshTokenExpired) {
|
if (window.isRefreshTokenExpired) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -20,6 +20,6 @@ export const Paths = {
|
|||||||
detail: '/learning/',
|
detail: '/learning/',
|
||||||
},
|
},
|
||||||
auth: {
|
auth: {
|
||||||
login: '/auth/login',
|
login: '/login',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -5,10 +5,13 @@ import Filters from '@/components/Filters'
|
|||||||
import Button from '@/components/Button'
|
import Button from '@/components/Button'
|
||||||
import { AddSquare } from 'iconsax-react'
|
import { AddSquare } from 'iconsax-react'
|
||||||
import Table from '@/components/Table'
|
import Table from '@/components/Table'
|
||||||
|
import { useGetMyOrders } from './hooks/useOrderData'
|
||||||
|
|
||||||
const MyOrders: FC = () => {
|
const MyOrders: FC = () => {
|
||||||
|
|
||||||
const [activeTab, setActiveTab] = useState<TabMyOrdersEnum>(TabMyOrdersEnum.ALL)
|
const [activeTab, setActiveTab] = useState<TabMyOrdersEnum>(TabMyOrdersEnum.ALL)
|
||||||
|
const { data } = useGetMyOrders()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='mt-5'>
|
<div className='mt-5'>
|
||||||
<h1>
|
<h1>
|
||||||
|
|||||||
@@ -13,3 +13,10 @@ export const useSubmitOrder = () => {
|
|||||||
mutationFn: api.submitOrder,
|
mutationFn: api.submitOrder,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const useGetMyOrders = () => {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["products"],
|
||||||
|
queryFn: api.getMyOrders,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -10,3 +10,8 @@ export const submitOrder = async (params: OrderType[]) => {
|
|||||||
const { data } = await axios.post(`/public/order`, { items: params });
|
const { data } = await axios.post(`/public/order`, { items: params });
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getMyOrders = async () => {
|
||||||
|
const { data } = await axios.get(`/public/orders`);
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export type SharedStoreType = {
|
|||||||
export interface BaseResponse<T> {
|
export interface BaseResponse<T> {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
statusCode: number;
|
statusCode: number;
|
||||||
|
status: number;
|
||||||
data: T;
|
data: T;
|
||||||
meta?: {
|
meta?: {
|
||||||
limit: number;
|
limit: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user