瀏覽代碼

fix

MergeProblem1
kelvin.yau 2 週之前
父節點
當前提交
88d1354944
共有 1 個檔案被更改,包括 21 行新增0 行删除
  1. +21
    -0
      src/app/api/warehouse/client.ts

+ 21
- 0
src/app/api/warehouse/client.ts 查看文件

@@ -31,4 +31,25 @@ export const exportWarehouseQrCode = async (warehouseIds: number[]): Promise<{ b

return { blobValue, filename };
};

export const fetchWarehouseListClient = async (): Promise<WarehouseResult[]> => {
const token = localStorage.getItem("accessToken");
const response = await fetch(`${NEXT_PUBLIC_API_URL}/warehouse`, {
method: "GET",
headers: {
"Content-Type": "application/json",
...(token && { Authorization: `Bearer ${token}` }),
},
});

if (!response.ok) {
if (response.status === 401) {
throw new Error("Unauthorized: Please log in again");
}
throw new Error(`Failed to fetch warehouse list: ${response.status} ${response.statusText}`);
}

return response.json();
};
//test

Loading…
取消
儲存