Make /profile be the default location
This commit is contained in:
parent
383d9deeb3
commit
198adfe395
|
|
@ -22,7 +22,11 @@ const LoginForm = ({ setRedirect, hasLabel, layout }) => {
|
||||||
const { t } = useTranslation('auth');
|
const { t } = useTranslation('auth');
|
||||||
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
let { from } = location.state || { from: { pathname: "/" } };
|
|
||||||
|
// We want to redirect to /profile after logging in , because we need to reserve `/` to be our 'mrketing site'
|
||||||
|
// So if somehow location.state says "/" , then we want to redirect to /profile
|
||||||
|
const defaultLocation = { pathname: "/profile" };
|
||||||
|
let { from } = location.state || { from: defaultLocation };
|
||||||
|
|
||||||
const { login, setCurrentUser } = useAuth();
|
const { login, setCurrentUser } = useAuth();
|
||||||
|
|
||||||
|
|
@ -39,7 +43,8 @@ const LoginForm = ({ setRedirect, hasLabel, layout }) => {
|
||||||
setEmail('')
|
setEmail('')
|
||||||
setPassword('')
|
setPassword('')
|
||||||
//setRedirect(true)
|
//setRedirect(true)
|
||||||
history.replace(from);
|
const finalDestination = from.pathname == "/" ? defaultLocation : from
|
||||||
|
history.replace(finalDestination);
|
||||||
}else{
|
}else{
|
||||||
toast.error("Incorrect email or password");
|
toast.error("Incorrect email or password");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,6 @@ export const getLatencyToUsers = (currentUserId, participantIds) => {
|
||||||
|
|
||||||
export const getLobbyChatMessages = (options = {}) => {
|
export const getLobbyChatMessages = (options = {}) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
console.log('getLobbyChatMessages', options);
|
|
||||||
apiFetch(`/chat?${new URLSearchParams(options)}`)
|
apiFetch(`/chat?${new URLSearchParams(options)}`)
|
||||||
.then(response => resolve(response))
|
.then(response => resolve(response))
|
||||||
.catch(error => reject(error));
|
.catch(error => reject(error));
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ const AuthCardLayout = ({ leftSideContent, children }) => {
|
||||||
<div className="z-index-1 position-relative">
|
<div className="z-index-1 position-relative">
|
||||||
<Link
|
<Link
|
||||||
className="text-white mb-4 text-sans-serif font-weight-extra-bold fs-4 d-inline-block"
|
className="text-white mb-4 text-sans-serif font-weight-extra-bold fs-4 d-inline-block"
|
||||||
to="/"
|
to="/profile"
|
||||||
>
|
>
|
||||||
falcon
|
falcon
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue