Skip to content

Commit

Permalink
Merge pull request #7 from EXPITC/develop
Browse files Browse the repository at this point in the history
fix: Loading state problems
  • Loading branch information
EXPITC authored Jun 15, 2023
2 parents 48fae4e + 42a227d commit 586862c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/components/Checkout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,15 @@ const CheckoutPage = () => {
/>
<input
required
type="number"
type="tel"
name="phone"
pattern="[0-9]{4}-[0-9]{4}-[0-9]{4}"
placeholder="Phone"
onChange={(e) => {
// prevent negative number and set limit 4 digit
e.target.value =
e.target.value > 0
? Math.abs(e.target.value.slice(0, 13))
: undefined;
let regex =
/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/;

e.target.value = e.target.value.replace(regex, "");
handleChange(e);
}}
value={form.phone}
Expand Down
4 changes: 3 additions & 1 deletion src/components/RouterSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const RouterSetup = () => {
})
)
.catch((err) => {
dispatch({ status: "logout" });
dispatch({ status: "isLogin", payload: false });
handleError(err);
});
if (!isLogin) return;
Expand All @@ -75,6 +75,7 @@ const RouterSetup = () => {
return () => controller.abort();
}, [dispatch, isLogin]);

// Info
useEffect(() => {
if (isLogin === null) return;
if (!isLogin) {
Expand All @@ -101,6 +102,7 @@ const RouterSetup = () => {
},
]);
}, [isLogin]);

return (
<Router>
<Routes>
Expand Down

1 comment on commit 586862c

@vercel
Copy link

@vercel vercel bot commented on 586862c Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ways-beans – ./

ways-beans-git-main-expitc.vercel.app
ways-beans-expitc.vercel.app
ways-beans.vercel.app

Please sign in to comment.