-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrecovery.tsx
37 lines (30 loc) · 1.08 KB
/
recovery.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import type { GetServerSideProps, NextPage } from "next";
import Head from "next/head";
import { useContext, useEffect } from "react";
import RecoveryContainer from "@components/home/recovery/RecoveryContainer";
import { ProjectContext } from "@src/context/ProjectContext";
type RecoveryProps = {
userId: number;
recoverHash: string;
};
const RecoveryPage: NextPage<RecoveryProps> = ({ userId, recoverHash }: RecoveryProps) => {
const { updateProject } = useContext(ProjectContext);
useEffect(() => updateProject(undefined), []);
return (
<>
<Head>
<title>Scriptio • Recover password</title>
</Head>
<RecoveryContainer userId={userId} recoverHash={recoverHash} />
</>
);
};
export const getServerSideProps: GetServerSideProps = async (ctx) => {
const userId = ctx.query["id"];
const recoverHash = ctx.query["code"];
if (recoverHash && userId) {
return { props: { userId, recoverHash } };
}
return { props: {} };
};
export default RecoveryPage;