* chore(eslint): add ignore pattern for packages/data-provider/types
chore(data-provider): fix import formatting in index.ts
chore(data-provider): add types/index.d.ts to tsconfig include

* fix(Auth): fix "skip login" bug, where UI would render in an unauthenticated state
fix(Login.tsx): replace navigate('/chat/new') with navigate('/chat/new', { replace: true })
fix(AuthContext.tsx): replace navigate(redirect) with navigate(redirect, { replace: true })
fix(AuthContext.tsx): replace navigate('/login') with navigate('/login', { replace: true })
fix(AuthContext.tsx): replace navigate('/login') with navigate('/login', { replace: true })
fix(routes/Chat.jsx): add check for isAuthenticated: navigate to '/login' and render null if not authenticated
fix(routes/index.jsx): add check for isAuthenticated: navigate to '/login' and render null if not authenticated

* refactor(SubmitButton.jsx): create a set of endpoints to hide set tokens
fix(SubmitButton.jsx): fix condition to check if token is provided for certain endpoints
This commit is contained in:
Danny Avila 2023-07-12 11:37:27 -04:00 committed by GitHub
parent 747e087cf5
commit f5672ddcf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 47 additions and 21 deletions

View file

@ -19,7 +19,7 @@ function Login() {
useEffect(() => {
if (isAuthenticated) {
navigate('/chat/new');
navigate('/chat/new', { replace: true });
}
}, [isAuthenticated, navigate]);

View file

@ -16,6 +16,7 @@ export default function SubmitButton({
const { getToken } = store.useToken(endpoint);
const isTokenProvided = endpointsConfig?.[endpoint]?.userProvide ? !!getToken() : true;
const endpointsToHideSetTokens = new Set(['openAI', 'azureOpenAI', 'bingAI']);
const clickHandler = (e) => {
e.preventDefault();
@ -38,7 +39,7 @@ export default function SubmitButton({
</div>
</button>
);
} else if (!isTokenProvided && (endpoint !== 'openAI' || endpoint !== 'azureOpenAI' )) {
} else if (!isTokenProvided && (!endpointsToHideSetTokens.has(endpoint))) {
return (
<>
<button