Skip to content

Commit fb2b510

Browse files
Merge pull request #49 from christensenep/LFG-220
fix(common): LFG-220 Fix is_visible product flag not being set via api
2 parents b5c7855 + d4da39b commit fb2b510

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pages/products/[pid].tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ const ProductInfo = () => {
2020
const handleSubmit = async (data: FormData) => {
2121
try {
2222
const filteredList = list.filter(item => item.id !== pid);
23+
const { description, isVisible, name, price, type } = data;
24+
const apiFormattedData = { description, is_visible: isVisible, name, price, type };
25+
2326
// Update local data immediately (reduce latency to user)
2427
mutateList([...filteredList, { ...product, ...data }], false);
2528

2629
// Update product details
2730
await fetch(`/api/products/${pid}?context=${encodedContext}`, {
2831
method: 'PUT',
2932
headers: { 'Content-Type': 'application/json' },
30-
body: JSON.stringify(data),
33+
body: JSON.stringify(apiFormattedData),
3134
});
3235

3336
// Refetch to validate local data

0 commit comments

Comments
 (0)