diff --git a/components/LoginSteps/LoginComponent.tsx b/components/LoginSteps/LoginComponent.tsx index c26a727..0bbed3a 100644 --- a/components/LoginSteps/LoginComponent.tsx +++ b/components/LoginSteps/LoginComponent.tsx @@ -4,6 +4,7 @@ import { useState } from "react"; import "react-phone-number-input/style.css"; import PhoneInput from "react-phone-number-input"; import { isPossiblePhoneNumber } from "react-phone-number-input"; +import { toast } from "react-toastify"; type StepType = { onChange: any; @@ -21,41 +22,40 @@ const LoginComponent = ({ onChange, setPhone }: StepType) => { console.log(phone); setPhone(phone); if (phone) { - if (phone.length == 12) { - phone = phone.substring(1); - await fetch(`${server}auth/requestOTP`, { - method: "post", - mode: "cors", - cache: "no-cache", - headers: { - Accept: "application/json", - "Content-Type": "application/json", - }, - credentials: "include", - body: JSON.stringify({ - phoneNumber: phone, - }), - }) - .then((res) => res.json()) - .then((json) => { - console.log(json); - if (json.status == "success") { - setTimeout(() => { - onChange(2); - }, 3000); - } - }) - .catch((error) => { - console.log(error); - }); - } else { - setError("Số điện thoại của bạn dường như chưa chính xác."); - } - - /* - - */ + if (phone.length == 12) { + phone = phone.substring(1); + await fetch(`${server}auth/requestOTP`, { + method: "post", + mode: "cors", + cache: "no-cache", + headers: { + Accept: "application/json", + "Content-Type": "application/json", + }, + credentials: "include", + body: JSON.stringify({ + phoneNumber: phone, + }), + }) + .then((res) => res.json()) + .then((json) => { + console.log(json); + if (json.status == "success") { + toast.success(" Success!", { autoClose: 1500 }); + setTimeout(() => { + onChange(2); + }, 3000); + } + }) + .catch((error) => { + console.log(error); + }); + } else { + toast.error(" Fail!", { autoClose: 1500 }); + setError("Số điện thoại của bạn dường như chưa chính xác."); + } } else { + toast.error(" Fail!", { autoClose: 1500 }); setError("Vui lòng nhập số điện thoại của bạn"); } }; diff --git a/components/header/index.tsx b/components/header/index.tsx index 781597f..b576790 100644 --- a/components/header/index.tsx +++ b/components/header/index.tsx @@ -20,6 +20,7 @@ const Header = ({ isErrorPage }: HeaderType) => { } } + useEffect(() => { if(!arrayPaths.includes(router.pathname) || isErrorPage) { return; @@ -47,7 +48,7 @@ const Header = ({ isErrorPage }: HeaderType) => {
- + Đặt hàng
@@ -57,7 +58,7 @@ const Header = ({ isErrorPage }: HeaderType) => {
- + Tải App
diff --git a/components/page-intro/contact.tsx b/components/page-intro/contact.tsx index 3496445..37bcad8 100644 --- a/components/page-intro/contact.tsx +++ b/components/page-intro/contact.tsx @@ -1,96 +1,96 @@ const Contact = () => { - return ( -
-
-
-
- - Liên hệ để trở thành đối tác của 2ALL hôm nay - -
- Chúng tôi chào đón đối tác trên toàn quốc để cùng cung cấp hàng - triệu bữa ăn ngon và lành cho khách hàng Việt Nam. -
-
-
-
-
-
Email
- + return ( +
+
+
+
+ + Liên hệ để trở thành đối tác của 2ALL hôm nay + +
+ Chúng tôi chào đón đối tác trên toàn quốc để cùng cung cấp hàng + triệu bữa ăn ngon và lành cho khách hàng Việt Nam. +
-
-
Message
- +
+
+
+
Email
+ +
+
+
Message
+ +
+
+ +
Tôi không phải robot
+ +
+
+
+
+ Gửi tin nhắn +
+
-
- -
Tôi không phải robot
+
+ +
+ + +
+ Cải Kale
-
-
-
- Gửi tin nhắn -
-
-
-
- -
- -
- - Cải Kale -
- -
- - Cà Chua -
+
+ + Cà Chua +
-
- +
+ -
- Summer Avo Salad -
Đang giao hàng
-
3:09 PM
+
+ Summer Avo Salad +
Đang giao hàng
+
3:09 PM
+
+
-
-
-
- ); +
+ ); }; export default Contact; diff --git a/components/page-intro/order-step.tsx b/components/page-intro/order-step.tsx index 7f95d08..b2a4156 100644 --- a/components/page-intro/order-step.tsx +++ b/components/page-intro/order-step.tsx @@ -3,7 +3,7 @@ const OrderStep = () => { return( -
+
Cách đặt hàng
@@ -84,7 +84,7 @@ const OrderStep = () => {
-
+
) }; diff --git a/components/page-intro/today.tsx b/components/page-intro/today.tsx index 37e2518..c1d9870 100644 --- a/components/page-intro/today.tsx +++ b/components/page-intro/today.tsx @@ -32,6 +32,9 @@ const Today = () => { ))} + +
+
) }; diff --git a/package.json b/package.json index 4c155ce..1d58fbc 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "react-redux": "^7.2.1", "react-router-dom": "^6.17.0", "react-select": "^3.1.0", + "react-toastify": "^9.1.3", "redux": "^4.0.5", "redux-devtools-extension": "^2.13.8", "redux-persist": "^6.0.0", diff --git a/pages/_app.tsx b/pages/_app.tsx index 5a5887a..7ba8d23 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,7 +1,8 @@ import React, { Fragment } from 'react'; import Router from 'next/router'; import {wrapper} from '../store'; - +import { ToastContainer } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; // types import type { AppProps } from 'next/app'; @@ -25,6 +26,16 @@ if(isProduction) { const MyApp = ({ Component, pageProps }: AppProps) => ( + ); diff --git a/yarn.lock b/yarn.lock index 3010954..88e1f6c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -496,6 +496,11 @@ classnames@2.x, classnames@^2.2.1, classnames@^2.2.5, classnames@^2.2.6, classna resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924" integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw== +clsx@^1.1.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12" + integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg== + color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -1208,6 +1213,13 @@ react-select@^3.1.0: react-input-autosize "^3.0.0" react-transition-group "^4.3.0" +react-toastify@^9.1.3: + version "9.1.3" + resolved "https://registry.yarnpkg.com/react-toastify/-/react-toastify-9.1.3.tgz#1e798d260d606f50e0fab5ee31daaae1d628c5ff" + integrity sha512-fPfb8ghtn/XMxw3LkxQBk3IyagNpF/LIKjOBflbexr2AWxAH1MJgvnESwEwBn9liLFXgTKWgBSdZpw9m4OTHTg== + dependencies: + clsx "^1.1.1" + react-transition-group@^4.3.0, react-transition-group@^4.4.5: version "4.4.5" resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-4.4.5.tgz#e53d4e3f3344da8521489fbef8f2581d42becdd1"