This commit is contained in:
@@ -1,20 +1,12 @@
|
|||||||
import axios from "@/config/axios";
|
import axios from "@/config/axios";
|
||||||
import type {
|
import type { GetRestaurantResponse, UpdateRestaurantType } from "../types/Types";
|
||||||
GetRestaurantResponse,
|
|
||||||
UpdateRestaurantType,
|
|
||||||
} from "../types/Types";
|
|
||||||
|
|
||||||
export const getRestaurant = async (): Promise<GetRestaurantResponse> => {
|
export const getRestaurant = async (): Promise<GetRestaurantResponse> => {
|
||||||
const { data } = await axios.get<GetRestaurantResponse>(
|
const { data } = await axios.get<GetRestaurantResponse>("/admin/shops/my-restaurant");
|
||||||
"/admin/restaurants/my-restaurant"
|
|
||||||
);
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateRestaurant = async (params: UpdateRestaurantType) => {
|
export const updateRestaurant = async (params: UpdateRestaurantType) => {
|
||||||
const { data } = await axios.patch(
|
const { data } = await axios.patch("/admin/shops/my-restaurant", params);
|
||||||
"/admin/restaurants/my-restaurant",
|
|
||||||
params
|
|
||||||
);
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,51 +1,29 @@
|
|||||||
import axios from "@/config/axios";
|
import axios from "@/config/axios";
|
||||||
import type {
|
import type { CreateShipmentMethodType, GetRestaurantShipmentMethodResponseType, GetRestaurantShipmentMethodsParams, GetRestaurantShipmentMethodsResponseType } from "../types/Types";
|
||||||
CreateShipmentMethodType,
|
|
||||||
GetRestaurantShipmentMethodsResponseType,
|
|
||||||
GetRestaurantShipmentMethodResponseType,
|
|
||||||
GetRestaurantShipmentMethodsParams,
|
|
||||||
} from "../types/Types";
|
|
||||||
|
|
||||||
export const getRestaurantShipmentMethods = async (
|
export const getRestaurantShipmentMethods = async (params?: GetRestaurantShipmentMethodsParams): Promise<GetRestaurantShipmentMethodsResponseType> => {
|
||||||
params?: GetRestaurantShipmentMethodsParams
|
const { data } = await axios.get("/admin/delivery-methods/shop", {
|
||||||
): Promise<GetRestaurantShipmentMethodsResponseType> => {
|
|
||||||
const { data } = await axios.get("/admin/delivery-methods/restaurant", {
|
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createRestaurantShipmentMethod = async (
|
export const createRestaurantShipmentMethod = async (params: CreateShipmentMethodType) => {
|
||||||
params: CreateShipmentMethodType
|
const { data } = await axios.post("/admin/delivery-methods/shop", params);
|
||||||
) => {
|
|
||||||
const { data } = await axios.post(
|
|
||||||
"/admin/delivery-methods/restaurant",
|
|
||||||
params
|
|
||||||
);
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteRestaurantShipmentMethod = async (id: string) => {
|
export const deleteRestaurantShipmentMethod = async (id: string) => {
|
||||||
const { data } = await axios.delete(
|
const { data } = await axios.delete(`/admin/delivery-methods/shop/${id}`);
|
||||||
`/admin/delivery-methods/restaurant/${id}`
|
|
||||||
);
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getRestaurantShipmentMethod = async (
|
export const getRestaurantShipmentMethod = async (id: string): Promise<GetRestaurantShipmentMethodResponseType> => {
|
||||||
id: string
|
const { data } = await axios.get(`/admin/delivery-methods/shop/${id}`);
|
||||||
): Promise<GetRestaurantShipmentMethodResponseType> => {
|
|
||||||
const { data } = await axios.get(`/admin/delivery-methods/restaurant/${id}`);
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateRestaurantShipmentMethod = async (
|
export const updateRestaurantShipmentMethod = async (id: string, params: CreateShipmentMethodType) => {
|
||||||
id: string,
|
const { data } = await axios.patch(`/admin/delivery-methods/shop/${id}`, params);
|
||||||
params: CreateShipmentMethodType
|
|
||||||
) => {
|
|
||||||
const { data } = await axios.patch(
|
|
||||||
`/admin/delivery-methods/restaurant/${id}`,
|
|
||||||
params
|
|
||||||
);
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user