summaryrefslogtreecommitdiff
path: root/src-migrate/common
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-10-28 09:05:00 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-10-28 09:05:00 +0700
commitc82110f7d3a2f85de99045fde7b579e369f15b2c (patch)
treedeae1b959583eff4fa283800efe6daaff9fe21e9 /src-migrate/common
parentcf6da809621b4ebe8c9acedb035b689e7e1b60b1 (diff)
Update authentication feature
Diffstat (limited to 'src-migrate/common')
-rw-r--r--src-migrate/common/components/elements/Modal.tsx4
-rw-r--r--src-migrate/common/types/auth.ts11
2 files changed, 13 insertions, 2 deletions
diff --git a/src-migrate/common/components/elements/Modal.tsx b/src-migrate/common/components/elements/Modal.tsx
index 91421251..8e488a3a 100644
--- a/src-migrate/common/components/elements/Modal.tsx
+++ b/src-migrate/common/components/elements/Modal.tsx
@@ -1,5 +1,6 @@
import { XMarkIcon } from "@heroicons/react/24/outline";
import { AnimatePresence, motion } from "framer-motion"
+import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import ReactDOM from "react-dom";
import { useWindowSize } from "usehooks-ts";
@@ -23,6 +24,7 @@ const Modal = ({
className,
mode
}: Props) => {
+ const router = useRouter()
const { width } = useWindowSize()
const [rendered, setRendered] = useState<boolean>(false)
@@ -49,7 +51,7 @@ const Modal = ({
}
return rendered && ReactDOM.createPortal(
- <AnimatePresence>
+ <AnimatePresence key={router.asPath}>
{active && (
<motion.div
className="overlay"
diff --git a/src-migrate/common/types/auth.ts b/src-migrate/common/types/auth.ts
index 3d9ffee4..ca7b562a 100644
--- a/src-migrate/common/types/auth.ts
+++ b/src-migrate/common/types/auth.ts
@@ -27,7 +27,7 @@ export type RegisterProps = {
export type RegisterResApiProps = {
register: boolean;
- reason: 'EMAIL_USED' | null;
+ reason: 'EMAIL_USED' | 'NOT_ACTIVE' | null;
};
type ActivationResProps = {
@@ -51,3 +51,12 @@ export type ActivationOtpProps = {
export type ActivationOtpResApiProps = ActivationResProps & {
reason: 'INVALID_OTP' | null;
};
+
+export type ActivationReqProps = {
+ email: string;
+};
+
+export type ActivationReqResApiProps = {
+ activation_request: boolean;
+ reason: 'NOT_FOUND' | 'ACTIVE' | null;
+};