Skip to content

Commit

Permalink
feat:fe: added redirect flow to signup page
Browse files Browse the repository at this point in the history
  • Loading branch information
shahul01 committed Nov 28, 2023
1 parent 5bdca17 commit 1bc7fcb
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion frontend/src/app/(pages)/auth/sign-up/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"use client";

import { useRouter } from 'next/navigation';
import Link from 'next/link';
import { useState } from 'react';
import styles from './signUp.module.css';
import toast, { toastConfig } from 'react-simple-toasts';


type ModelUser = {
Expand All @@ -18,6 +20,12 @@ type SignUpProps = {
const SignUp:SignUpProps = (props: {}) => {
const { } = props;

const router = useRouter();
toastConfig({
position: 'top-center',
duration: 3000,
className: 'custom-toast'
});
const initialForm = {
username: '',
password: '',
Expand Down Expand Up @@ -65,12 +73,22 @@ const SignUp:SignUpProps = (props: {}) => {
body: JSON.stringify(form)
});

console.log(`postReq: `, postReq);
const resPost = await postReq.json();
const resData = resPost.data;
console.log(`submittedFormData: `, resData);

if (resData.id) {
console.log(`submittedFormData: `, resData);
toast('Signed up, redirecting...');
setTimeout(() => {
router.push('/auth/sign-in');
}, 800);

};

};


return (
<div className={styles['sign-up']}>
<h1>SignUp</h1>
Expand Down

0 comments on commit 1bc7fcb

Please sign in to comment.