mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
fix browser refresh redirecting to /chat/new (#210)
This commit is contained in:
parent
d7b415837b
commit
3b4ed98c1d
2 changed files with 1 additions and 5 deletions
|
|
@ -3,7 +3,6 @@ const Conversation = require('./schema/convoSchema');
|
|||
const { getMessages, deleteMessages } = require('./Message');
|
||||
|
||||
const getConvo = async (user, conversationId) => {
|
||||
console.log('getConvo -> userId', user);
|
||||
try {
|
||||
return await Conversation.findOne({ user, conversationId }).exec();
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import {
|
|||
TLoginUser
|
||||
} from '~/data-provider';
|
||||
import { useNavigate, useLocation } from 'react-router-dom';
|
||||
import store from '~/store';
|
||||
|
||||
export type TAuthContext = {
|
||||
user: TUser | undefined,
|
||||
|
|
@ -47,8 +46,6 @@ const AuthContextProvider = ({ children }: { children: ReactNode }) => {
|
|||
|
||||
const location = useLocation();
|
||||
|
||||
const { newConversation } = store.useConversation();
|
||||
|
||||
const setUserContext = (userContext: TUserContext) => {
|
||||
const { token, isAuthenticated, user, redirect } = userContext;
|
||||
if(user) {
|
||||
|
|
@ -110,7 +107,7 @@ const AuthContextProvider = ({ children }: { children: ReactNode }) => {
|
|||
const tokenFromCookie = getCookieValue('token');
|
||||
if (tokenFromCookie) {
|
||||
// debugger;
|
||||
setUserContext({ token: tokenFromCookie, isAuthenticated: true, user: userQuery.data, redirect: '/chat/new' })
|
||||
setUserContext({ token: tokenFromCookie, isAuthenticated: true, user: userQuery.data })
|
||||
}
|
||||
else {
|
||||
navigate('/login');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue