Proper authentication (needs more user feedback)
This commit is contained in:
@@ -28,7 +28,7 @@ export function AuthProvider({children}: PropsWithChildren) {
|
||||
const load = async () => {
|
||||
|
||||
if (searchParams.get("openid.ns") !== null) {
|
||||
let response = await fetch("http://localhost:8080/login?" + searchParams.toString()).then(r => r.text());
|
||||
let response = await fetch("http://localhost:8080/login?" + searchParams.toString(), {credentials: "include"}).then(r => r.text());
|
||||
setSeachParams({}, {replace: true});
|
||||
if (response === "nok") {
|
||||
// TODO: signal error to user
|
||||
@@ -50,6 +50,7 @@ export function AuthProvider({children}: PropsWithChildren) {
|
||||
};
|
||||
|
||||
const logout = async () => {
|
||||
await fetch("http://localhost:8080/logout", {credentials: "include"})
|
||||
setUser(null);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user