feat(api): add create and update product routes with authentication

refactor(admin): integrate router refresh after product updates in forms
fix(imports): update fetch paths for product creation and update in ReceiptImportClient
This commit is contained in:
Nils-Johan Gynther
2026-04-19 18:12:29 +02:00
parent 90b02c4690
commit f12d881395
7 changed files with 177 additions and 8 deletions
-6
View File
@@ -108,8 +108,6 @@ export async function updateProductWithTags(formData: FormData, tags: string[])
const text = await tagsRes.text();
throw new Error(`Kunde inte uppdatera taggar: ${text}`);
}
revalidatePath('/admin/products');
}
export async function deleteProduct(id: number) {
@@ -123,8 +121,6 @@ export async function deleteProduct(id: number) {
const text = await res.text();
throw new Error(`Kunde inte ta bort produkt: ${text}`);
}
revalidatePath('/admin/products');
}
export async function resetAllProducts() {
@@ -155,8 +151,6 @@ export async function bulkSetCategory(ids: number[], categoryId: number | null)
const text = await res.text();
throw new Error(`Kunde inte uppdatera produkter: ${text}`);
}
revalidatePath('/admin/products');
}
export async function suggestProductCategory(productId: number) {