larxius commited on
Commit
c4de973
·
verified ·
1 Parent(s): 2f8fd04

Update frontend/src/pages/Register.jsx

Browse files
Files changed (1) hide show
  1. frontend/src/pages/Register.jsx +3 -2
frontend/src/pages/Register.jsx CHANGED
@@ -1,6 +1,7 @@
1
  import React, { useState, useEffect } from 'react';
2
  import { Link, useNavigate } from 'react-router-dom';
3
  import { useAuth } from '../components/AuthContext';
 
4
 
5
  export const Register = () => {
6
  const [fullName, setFullName] = useState('');
@@ -58,8 +59,8 @@ export const Register = () => {
58
 
59
  const data = await res.json();
60
  if (res.ok) {
61
- login(data.access_token || data.token, data.refresh_token, data.user);
62
- navigate('/dashboard');
63
  } else {
64
  setError(data.message || 'Registration failed. Please try again.');
65
  }
 
1
  import React, { useState, useEffect } from 'react';
2
  import { Link, useNavigate } from 'react-router-dom';
3
  import { useAuth } from '../components/AuthContext';
4
+ import toast from 'react-hot-toast';
5
 
6
  export const Register = () => {
7
  const [fullName, setFullName] = useState('');
 
59
 
60
  const data = await res.json();
61
  if (res.ok) {
62
+ toast.success('Account created successfully! Please sign in with your credentials.');
63
+ navigate('/login', { state: { email } });
64
  } else {
65
  setError(data.message || 'Registration failed. Please try again.');
66
  }