Skip to content

Commit e599bbb

Browse files
committed
Adds mail acceptance for registrations
1 parent 2e20e56 commit e599bbb

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/app/accept/page.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"use client"
2+
import {useEffect} from "react";
3+
import {RegistrationRest} from "../../rest/RegistrationRest";
4+
import {Box, CircularProgress, Typography} from "@mui/material";
5+
import {useRouter} from "next/navigation";
6+
7+
export default function Page() {
8+
9+
const router = useRouter()
10+
11+
useEffect(() => {
12+
if (typeof window !== 'undefined') {
13+
const queryParameters = new URLSearchParams(window?.location?.search)
14+
const token = queryParameters.get("t")
15+
const registration = queryParameters.get("r")
16+
const registrationRest = new RegistrationRest()
17+
registrationRest.acceptWithToken(registration, token).then(() => router.push("/?isVerified=true"))
18+
}
19+
20+
}, []);
21+
return <Box sx={{padding: 10, display: "flex", justifyContent: "center"}}>
22+
<Box >
23+
<CircularProgress color={"inherit"}/>
24+
<Typography>Verifying your Token</Typography>
25+
</Box>
26+
</Box>
27+
}

src/rest/RegistrationRest.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ export class RegistrationRest{
88
return axios.post(this.baseUrl+"/registration", data)
99
}
1010

11+
acceptWithToken(registrationId, token) {
12+
return axios.post(`${this.baseUrl}/registration/id/${registrationId}/accept/token/${token}`);
13+
}
14+
1115
}

0 commit comments

Comments
 (0)