hmmmammamam
This commit is contained in:
@@ -1,5 +1,18 @@
|
||||
import { fetchData } from '@/lib/data-service';
|
||||
import { normalizeApiUrl } from './api-utils';
|
||||
|
||||
/**
|
||||
* Interface for shipping method data
|
||||
*/
|
||||
interface ShippingMethod {
|
||||
name: string;
|
||||
price: number;
|
||||
_id?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches all shipping methods for the current store
|
||||
*/
|
||||
export const fetchShippingMethods = async (authToken: string) => {
|
||||
try {
|
||||
const res = await fetchData(
|
||||
@@ -23,12 +36,9 @@ export const fetchShippingMethods = async (authToken: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
interface ShippingMethod {
|
||||
name: string;
|
||||
price: number;
|
||||
_id?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new shipping method
|
||||
*/
|
||||
export const addShippingMethod = async (
|
||||
authToken: string,
|
||||
newShipping: Omit<ShippingMethod, "_id">
|
||||
@@ -69,6 +79,9 @@ export const addShippingMethod = async (
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Deletes a shipping method by ID
|
||||
*/
|
||||
export const deleteShippingMethod = async (authToken: string, id: string) => {
|
||||
try {
|
||||
const res = await fetchData(
|
||||
@@ -88,10 +101,13 @@ export const deleteShippingMethod = async (authToken: string, id: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates an existing shipping method
|
||||
*/
|
||||
export const updateShippingMethod = async (
|
||||
authToken: string,
|
||||
id: string,
|
||||
updatedShipping: any
|
||||
updatedShipping: Partial<ShippingMethod>
|
||||
) => {
|
||||
try {
|
||||
const res = await fetchData(
|
||||
|
||||
Reference in New Issue
Block a user