Skip to content
Snippets Groups Projects
Commit adcc21ee authored by Leonardo Christino's avatar Leonardo Christino
Browse files

chore(auth): update useAuth

standardize fetch with cookie-based auth call
parent 371d603e
No related branches found
No related tags found
No related merge requests found
Pipeline #127491 passed
......@@ -70,21 +70,6 @@ export function App(props: App) {
Broker.instance().subscribe((data: LinkPredictionInstance[]) => dispatch(setMLResult({ type: mlType, result: data })), mlType);
});
const domain = import.meta.env.BACKEND_URL;
const useruri = import.meta.env.BACKEND_USER;
fetch(`${domain}${useruri}/headers`, {
method: 'GET',
redirect: 'follow',
});
fetch(`${domain}${useruri}/headers`, {
method: 'GET',
credentials: 'include',
redirect: 'follow',
headers: {
Authorization: `Bearer ${auth.accessToken}`,
},
});
return () => {
Broker.instance().unSubscribeAll('schema_result');
Broker.instance().unSubscribeAll('query_result');
......@@ -96,8 +81,8 @@ export function App(props: App) {
useEffect(() => {
// New active database
if (auth.accessToken && session.currentDatabase) {
ws.current.useToken(auth.accessToken).connect(() => {
if (auth.jwt && session.currentDatabase) {
ws.current.useToken(auth.jwt).connect(() => {
api_schema.RequestSchema(session.currentDatabase);
});
}
......
......@@ -81,7 +81,7 @@ export const Navbar = (props: NavbarComponentProps) => {
</a>
<SearchBar />
<div className="dropdown">
<label tabIndex={0} className="s-1">
<label tabIndex={0} className="btn s-1">
Vis
</label>
<ul tabIndex={0} className="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-52">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment