Skip to content

Commit 9e960e7

Browse files
Kylehtransprestrelski
authored andcommitted
final v1 changes
1 parent a115890 commit 9e960e7

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/actions/auth.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { setCookie, deleteCookie } from '../utils/cookie';
44
import { User } from '../UserContext';
55
import { COMPETITIONS_COOKIE_NAME, COOKIE_NAME } from '../configs';
66

7+
interface RegisterResponse {
8+
msg: string;
9+
id: string;
10+
}
11+
712
export const resetPassword = async (data: {
813
userID: string;
914
code: string;
@@ -78,11 +83,11 @@ export const registerUser = async (data: {
7883
email: data.email,
7984
isUCSD: data.isUCSD,
8085
};
81-
return new Promise((resolve, reject) => {
86+
return new Promise<RegisterResponse>((resolve, reject) => {
8287
axios
8388
.post(process.env.REACT_APP_API + '/v1/users', body)
8489
.then((res: AxiosResponse) => {
85-
resolve(res);
90+
resolve(res.data);
8691
})
8792
.catch((error) => {
8893
message.error(error.response.data.error.message);

src/pages/Auth/RegisterPage/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ function RegisterPage() {
2121
handlePasswordErrors(errors);
2222
}
2323
registerUser({ ...values, isUCSD: checked, admin: isAdmin }).then((res) => {
24+
message.success('Please check your email to verify your account');
2425
message.success(isAdmin ?
2526
'Admin registered! Redirecting to login page' :
2627
'Registered! Redirecting to login page');
27-
history.push('/login');
28+
history.push('/verify/?id=' + res.id);
2829
});
2930
};
3031
const onCheckChange = (e: any) => {

0 commit comments

Comments
 (0)