Update frontend
This commit is contained in:
@@ -20,7 +20,7 @@ export default function LoginPage() {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setError("");
|
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",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ username, password }),
|
body: JSON.stringify({ username, password }),
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ export default function ProductsPage() {
|
|||||||
await saveProductImage(`${process.env.NEXT_PUBLIC_API_URL}/products/${savedProduct._id}/image`, file, authToken);
|
await saveProductImage(`${process.env.NEXT_PUBLIC_API_URL}/products/${savedProduct._id}/image`, file, authToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update state with the saved product
|
|
||||||
setProducts((prevProducts) => {
|
setProducts((prevProducts) => {
|
||||||
if (editing) {
|
if (editing) {
|
||||||
return prevProducts.map((product) =>
|
return prevProducts.map((product) =>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const saveProductImage = async(url: string, file:File, authToken: string)
|
|||||||
formData.append("file", file);
|
formData.append("file", file);
|
||||||
|
|
||||||
return await fetchData(url, {
|
return await fetchData(url, {
|
||||||
method: "POST",
|
method: "PUT",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${authToken}`,
|
Authorization: `Bearer ${authToken}`,
|
||||||
//"Content-Type": "multipart/form-data",
|
//"Content-Type": "multipart/form-data",
|
||||||
|
|||||||
Reference in New Issue
Block a user