Update shippingHelper.ts
This commit is contained in:
@@ -3,7 +3,7 @@ import { fetchData } from '@/lib/data-service';
|
||||
export const fetchShippingMethods = async (authToken: string) => {
|
||||
try {
|
||||
const res = await fetchData(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/shipping-options`,
|
||||
`/api/shipping-options`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${authToken}`,
|
||||
@@ -35,7 +35,7 @@ export const addShippingMethod = async (
|
||||
): Promise<ShippingMethod[]> => {
|
||||
try {
|
||||
const res = await fetchData(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/shipping-options`,
|
||||
`/api/shipping-options`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -72,7 +72,7 @@ export const addShippingMethod = async (
|
||||
export const deleteShippingMethod = async (authToken: string, id: string) => {
|
||||
try {
|
||||
const res = await fetchData(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/shipping-options/${id}`,
|
||||
`/api/shipping-options/${id}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers: { Authorization: `Bearer ${authToken}` },
|
||||
@@ -95,7 +95,7 @@ export const updateShippingMethod = async (
|
||||
) => {
|
||||
try {
|
||||
const res = await fetchData(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/shipping-options/${id}`,
|
||||
`/api/shipping-options/${id}`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user