Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

[frontend] fix #174

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/components/Cart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const Cart = ({ products, cartInfo, refresh }: Props) => {
alert('please wait for the checkout data');
return;
}
if (getValues('card_id') === null) {
if (!getValues('card_id')) {
if (checkoutData.payments.length === 0) {
alert('please add a card');
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,13 @@ const EachSellerCoupon = () => {
if (!resp.ok) {
if (resp.status === 500) {
alert("error on modifying coupon, please check your shop's status");
navigate('/user/seller/manageCoupons');
} else {
const response = await resp.json();
alert(response.message);
}
} else {
navigate('/user/seller/manageCoupons');
return;
}
};

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/user/seller/allCoupons/newCoupon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ const NewSellerCoupon = () => {
if (!resp.ok) {
if (resp.status === 500) {
alert("error on adding tag, please check your shop's status");
navigate('/user/seller/manageCoupons');
} else {
alert('error when creating new tag');
}
navigate('/user/seller/manageCoupons');
return;
} else {
const response = await resp.json();
append({ name: newTagName, tag_id: response.id });
Expand Down Expand Up @@ -196,12 +195,13 @@ const NewSellerCoupon = () => {
if (!resp.ok) {
if (resp.status === 500) {
alert("error on creating coupon, please check your shop's status");
navigate('/user/seller/manageCoupons');
} else {
const response = await resp.json();
alert(response.message);
}
} else {
navigate('/user/seller/manageCoupons');
return;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,13 @@ const EachSellerGoods = () => {
navigate('/user/seller/manageProducts');
return;
}
} else {
navigate('/user/seller/manageProducts');
}
return await response.json();
},
onSuccess: (responseData: PatchResponseProps) => {
// set value is redundant
setValue('name', responseData.name);
setValue('description', responseData.description);
setValue('price', responseData.price);
Expand Down