fix
This commit is contained in:
@@ -43,7 +43,6 @@ export const saveProductImage = async(url: string, file:File, authToken: string)
|
||||
method: "PUT",
|
||||
headers: {
|
||||
Authorization: `Bearer ${authToken}`,
|
||||
//"Content-Type": "multipart/form-data",
|
||||
},
|
||||
body: formData,
|
||||
});
|
||||
@@ -70,9 +69,9 @@ export const deleteProductData = async (url: string, authToken: string) => {
|
||||
};
|
||||
|
||||
// Stock management functions
|
||||
export const fetchStockData = async (authToken: string) => {
|
||||
export const fetchStockData = async (url: string, authToken: string) => {
|
||||
try {
|
||||
return await fetchData('/api/stock', {
|
||||
return await fetchData(url, {
|
||||
headers: { Authorization: `Bearer ${authToken}` },
|
||||
credentials: "include",
|
||||
});
|
||||
@@ -92,7 +91,8 @@ export const updateProductStock = async (
|
||||
authToken: string
|
||||
) => {
|
||||
try {
|
||||
return await fetchData(`/api/stock/${productId}`, {
|
||||
const url = `${process.env.NEXT_PUBLIC_API_URL}/stock/${productId}`;
|
||||
return await fetchData(url, {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
Authorization: `Bearer ${authToken}`,
|
||||
|
||||
Reference in New Issue
Block a user