frontend/app/api/Login.ts
2026-03-14 17:25:17 +01:00

19 lines
555 B
TypeScript

import axios from "axios";
export class Login
{
email?: string;
password?: string;
static login(login: Login, onSuccess: (token: string) => void, onError: () => void)
{
axios.post<string>(useRuntimeConfig().public.baseUrl + '/sessions/' + useRuntimeConfig().public.realmId, login, { maxRedirects: 1 })
.then((response) => {
console.log(response.headers['Location']);
onSuccess(response.data);
})
.catch(() => {
onError();
});
}
}