structure shipment method

This commit is contained in:
hamid zarghami
2025-11-23 15:42:52 +03:30
parent c37c1929a7
commit 255a07df06
7 changed files with 64 additions and 2 deletions
+29
View File
@@ -0,0 +1,29 @@
import { type FC } from 'react'
import { useGetRestaurantShipmentMethods } from './hooks/useShipmentMethodData'
import { Link } from 'react-router-dom'
import { Pages } from '@/config/Pages'
import Button from '@/components/Button'
import { Add } from 'iconsax-react'
const ShipmentMethodList: FC = () => {
const { data: shipmentMethodsData, isLoading } = useGetRestaurantShipmentMethods()
return (
<div className='mt-5'>
<div className='flex justify-between items-center'>
<h1 className='text-lg font-light'>لیست روش های ارسال</h1>
<Link to={Pages.shipment_methods.add}>
<Button className='w-fit px-6'>
<div className='flex gap-2 items-center'>
<Add color='#fff' size={20} />
<span>افزودن روش ارسال</span>
</div>
</Button>
</Link>
</div>
</div>
)
}
export default ShipmentMethodList
@@ -0,0 +1,9 @@
import { useQuery } from "@tanstack/react-query";
import * as api from "../service/ShipmentMethodService";
export const useGetRestaurantShipmentMethods = () => {
return useQuery({
queryKey: ["restaurant-shipment-methods"],
queryFn: api.getRestaurantShipmentMethods,
});
};
@@ -0,0 +1,6 @@
import axios from "@/config/axios";
export const getRestaurantShipmentMethods = async () => {
const { data } = await axios.get("/admin/restaurant-shipment-methods");
return data;
};