Update frontend

This commit is contained in:
g
2025-02-08 16:30:23 +00:00
parent bce4b26ffa
commit 5d10a3aabb
3 changed files with 3 additions and 4 deletions

View File

@@ -20,12 +20,12 @@ export default function LoginPage() {
e.preventDefault();
setError("");
const res = await fetchData("https://internal-api.inboxi.ng/api/auth/login", {
const res = await fetchData("http://localhost:3001/api/auth/login", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ username, password }),
});
if (res.token) {
document.cookie = `Authorization=${res.token}; path=/; Secure; SameSite=Strict; max-age=604800`;
router.push("/dashboard");

View File

@@ -141,7 +141,6 @@ export default function ProductsPage() {
await saveProductImage(`${process.env.NEXT_PUBLIC_API_URL}/products/${savedProduct._id}/image`, file, authToken);
}
// Update state with the saved product
setProducts((prevProducts) => {
if (editing) {
return prevProducts.map((product) =>

View File

@@ -40,7 +40,7 @@ export const saveProductImage = async(url: string, file:File, authToken: string)
formData.append("file", file);
return await fetchData(url, {
method: "POST",
method: "PUT",
headers: {
Authorization: `Bearer ${authToken}`,
//"Content-Type": "multipart/form-data",