feat: add search parameter keys for redirect and message handling in login flow
This commit is contained in:
@@ -2,6 +2,7 @@ import { Text } from '@radix-ui/themes';
|
||||
import { AxiosError } from 'axios';
|
||||
import { useLocation, useNavigate } from 'react-router';
|
||||
import { toast } from 'react-toastify';
|
||||
import { SearchParamKeys } from '../lib/constants';
|
||||
|
||||
export enum ResponseErrorToastId {
|
||||
NetworkError = 'network-error',
|
||||
@@ -74,8 +75,8 @@ const defaultResponseErrorHandler =
|
||||
// store current path for redirect after login
|
||||
const currentPath = location.pathname + location.search;
|
||||
const searchParam = new URLSearchParams();
|
||||
searchParam.set('redirect', currentPath);
|
||||
searchParam.set('message', 'Session expired, please log in again');
|
||||
searchParam.set(SearchParamKeys.Redirect, currentPath);
|
||||
searchParam.set(SearchParamKeys.Message, 'Session expired, please log in again');
|
||||
navigate(`/login?${searchParam.toString()}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user