implementation error handler
This commit is contained in:
@@ -34,7 +34,7 @@ const NavyFormComponent = () => {
|
||||
setProvinceList(formattedData);
|
||||
})
|
||||
.catch((error) => {
|
||||
Notifications(directionApp, t, error.response);
|
||||
Notifications(t, error.response);
|
||||
});
|
||||
}, []);
|
||||
// end get province list
|
||||
@@ -115,7 +115,7 @@ const NavyFormComponent = () => {
|
||||
|
||||
// submit
|
||||
const handleSubmit = async (values, props) => {
|
||||
Notifications(directionApp, t, undefined);
|
||||
Notifications(t, undefined);
|
||||
const formData = new FormData();
|
||||
formData.append("name", values.name);
|
||||
formData.append("phone_number", values.phone_number);
|
||||
@@ -138,10 +138,10 @@ const NavyFormComponent = () => {
|
||||
},
|
||||
})
|
||||
.then(function (response) {
|
||||
Notifications(directionApp, t, response);
|
||||
Notifications(t, response);
|
||||
})
|
||||
.catch(function (error) {
|
||||
Notifications(directionApp, t, error.response);
|
||||
Notifications(t, error.response);
|
||||
props.setSubmitting(false);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -87,7 +87,7 @@ const WelfareServicesFormComponent = () => {
|
||||
});
|
||||
|
||||
const handleSubmit = async (values, props) => {
|
||||
Notifications(directionApp, t, undefined);
|
||||
Notifications(t, undefined);
|
||||
const formData = new FormData();
|
||||
formData.append("name", values.name);
|
||||
formData.append("phone_number", values.phone_number);
|
||||
@@ -109,10 +109,10 @@ const WelfareServicesFormComponent = () => {
|
||||
},
|
||||
})
|
||||
.then(function (response) {
|
||||
Notifications(directionApp, t, response);
|
||||
Notifications(t, response);
|
||||
})
|
||||
.catch(function (error) {
|
||||
Notifications(directionApp, t, error.response);
|
||||
Notifications(t, error.response);
|
||||
props.setSubmitting(false);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ import {NextLinkComposed} from "@/core/components/LinkRouting";
|
||||
import CenterLayout from "@/layouts/CenterLayout";
|
||||
import FullPageLayout from "@/layouts/FullPageLayout";
|
||||
import useUser from "@/lib/app/hooks/useUser";
|
||||
import {Button, Typography} from "@mui/material";
|
||||
import {Button, Stack, Typography} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import SvgDashboard from "@/core/components/svgs/SvgDashboard";
|
||||
|
||||
@@ -41,6 +41,14 @@ const FirstComponent = () => {
|
||||
</Button>
|
||||
)}
|
||||
</CenterLayout>
|
||||
<Stack direction="row" alignItems="center" justifyContent="center">
|
||||
<Typography variant={"caption"}
|
||||
sx={{
|
||||
color: 'primary.main',
|
||||
fontFamily: 'Arial',
|
||||
fontWeight: 'bold'
|
||||
}}>v{process.env.NEXT_PUBLIC_API_VERSION}</Typography>
|
||||
</Stack>
|
||||
</FullPageLayout>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -37,18 +37,18 @@ const SendTokenComponent = ({
|
||||
});
|
||||
|
||||
const handleSubmit = async (values, props) => {
|
||||
Notifications(directionApp, t, undefined);
|
||||
Notifications(t, undefined);
|
||||
await axios
|
||||
.post(LOGIN, {
|
||||
phone_number: values.phone_number,
|
||||
verification_code: values.verification_code,
|
||||
})
|
||||
.then(function (response) {
|
||||
Notifications(directionApp, t, response);
|
||||
Notifications(t, response);
|
||||
setToken(response.data.token);
|
||||
})
|
||||
.catch(function (error) {
|
||||
Notifications(directionApp, t, error.response);
|
||||
Notifications(t, error.response);
|
||||
props.setSubmitting(false);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -36,19 +36,19 @@ const SendUserDataComponent = ({
|
||||
});
|
||||
|
||||
const handleSubmit = async (values, props) => {
|
||||
Notifications(directionApp, t, undefined);
|
||||
Notifications(t, undefined);
|
||||
await axios
|
||||
.post(SEND_OTP_TOKEN, {
|
||||
phone_number: values.phone_number,
|
||||
})
|
||||
.then(function (response) {
|
||||
Notifications(directionApp, t, response);
|
||||
Notifications(t, response);
|
||||
setPhoneNumber(values.phone_number);
|
||||
setOtpToken(true);
|
||||
setTimer(initialTimerValue);
|
||||
})
|
||||
.catch(function (error) {
|
||||
Notifications(directionApp, t, error.response);
|
||||
Notifications(t, error.response);
|
||||
props.setSubmitting(false);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -37,19 +37,19 @@ const RequestOtpComponent = ({
|
||||
});
|
||||
|
||||
const handleSubmit = async (values, props) => {
|
||||
Notifications(directionApp, t, undefined);
|
||||
Notifications(t, undefined);
|
||||
await axios
|
||||
.post(SEND_OTP_TOKEN, {
|
||||
phone_number: values.phone_number,
|
||||
})
|
||||
.then(function (response) {
|
||||
Notifications(directionApp, t, response);
|
||||
Notifications(t, response);
|
||||
setPhoneNumber(values.phone_number);
|
||||
setOtpToken(true);
|
||||
setTimer(initialTimerValue);
|
||||
})
|
||||
.catch(function (error) {
|
||||
Notifications(directionApp, t, error.response);
|
||||
Notifications(t, error.response);
|
||||
props.setSubmitting(false);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ const UserRegisterComponent = ({
|
||||
});
|
||||
|
||||
const handleSubmit = async (values, props) => {
|
||||
Notifications(directionApp, t, undefined);
|
||||
Notifications(t, undefined);
|
||||
console.log(initialValues);
|
||||
await axios
|
||||
.post(REGISTER, {
|
||||
@@ -56,12 +56,12 @@ const UserRegisterComponent = ({
|
||||
verification_code: values.verification_code,
|
||||
})
|
||||
.then(function (response) {
|
||||
Notifications(directionApp, t, response);
|
||||
Notifications(t, response);
|
||||
setOtpToken(true);
|
||||
setToken(response.data.token);
|
||||
})
|
||||
.catch(function (error) {
|
||||
Notifications(directionApp, t, error.response);
|
||||
Notifications(t, error.response);
|
||||
props.setSubmitting(false);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ const UserRegisterComponent = ({
|
||||
});
|
||||
|
||||
const handleSubmit = async (values, props) => {
|
||||
Notifications(directionApp, t, undefined);
|
||||
Notifications(t, undefined);
|
||||
console.log(initialValues);
|
||||
await axios
|
||||
.post(REGISTER, {
|
||||
@@ -53,12 +53,12 @@ const UserRegisterComponent = ({
|
||||
verification_code: values.verification_code,
|
||||
})
|
||||
.then(function (response) {
|
||||
Notifications(directionApp, t, response);
|
||||
Notifications(t, response);
|
||||
setOtpToken(true);
|
||||
setToken(response.data.token);
|
||||
})
|
||||
.catch(function (error) {
|
||||
Notifications(directionApp, t, error.response);
|
||||
Notifications(t, error.response);
|
||||
props.setSubmitting(false);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user