feat: add reviews, notifications, notes and account hardening
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { authApi, saveSession } from '../services/api';
|
||||
import { paths } from '../lib/routes';
|
||||
|
||||
export const AccessTokenPage: React.FC<{ mode: 'invite' | 'reset' }> = ({ mode }) => {
|
||||
const location = useLocation();
|
||||
@@ -19,7 +20,7 @@ export const AccessTokenPage: React.FC<{ mode: 'invite' | 'reset' }> = ({ mode }
|
||||
if (mode === 'invite') {
|
||||
const session = await authApi.acceptInvitation(token, name, password);
|
||||
saveSession(session); navigate(session.user.role === 'admin' ? '/admin' : session.user.role === 'instructor' ? '/gerenciar' : '/');
|
||||
} else { await authApi.resetPassword(token, password); navigate('/'); }
|
||||
} else { await authApi.resetPassword(token, password); navigate(paths.signIn, { replace: true }); }
|
||||
} catch { setError('Este link é inválido, expirou ou não pôde ser usado.'); }
|
||||
finally { setSaving(false); }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user