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