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) { ...@@ -70,21 +70,6 @@ export function App(props: App) {
Broker.instance().subscribe((data: LinkPredictionInstance[]) => dispatch(setMLResult({ type: mlType, result: data })), mlType); 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 () => { return () => {
Broker.instance().unSubscribeAll('schema_result'); Broker.instance().unSubscribeAll('schema_result');
Broker.instance().unSubscribeAll('query_result'); Broker.instance().unSubscribeAll('query_result');
...@@ -96,8 +81,8 @@ export function App(props: App) { ...@@ -96,8 +81,8 @@ export function App(props: App) {
useEffect(() => { useEffect(() => {
// New active database // New active database
if (auth.accessToken && session.currentDatabase) { if (auth.jwt && session.currentDatabase) {
ws.current.useToken(auth.accessToken).connect(() => { ws.current.useToken(auth.jwt).connect(() => {
api_schema.RequestSchema(session.currentDatabase); api_schema.RequestSchema(session.currentDatabase);
}); });
} }
......
...@@ -81,7 +81,7 @@ export const Navbar = (props: NavbarComponentProps) => { ...@@ -81,7 +81,7 @@ export const Navbar = (props: NavbarComponentProps) => {
</a> </a>
<SearchBar /> <SearchBar />
<div className="dropdown"> <div className="dropdown">
<label tabIndex={0} className="s-1"> <label tabIndex={0} className="btn s-1">
Vis Vis
</label> </label>
<ul tabIndex={0} className="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-52"> <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