This commit is contained in:
Bastian Wagner
2024-09-05 12:04:26 +02:00
parent fe6b8a8984
commit 98fcf058a6

View File

@@ -34,33 +34,9 @@ export class LoginComponent {
constructor() {
this.getclient();
this.loginWithSessionId();
}
loginWithSessionId() {
const id = window.localStorage.getItem("auth_session_key");
if (!id ||id.length < 2) { return; }
const url = this.client_id ? 'api/auth/login-with-session-id' : 'api/auth/login-with-session-id/userlogin'
this.http.post(url, {
code: id,
client_id: this.client_id
}).pipe(
this.toast.observe({
loading: 'Logging in...',
success: 'Logged in',
error: 'Invalid session, please log in with your credentials'
})
).subscribe({
next: (data) => {
this.handleLoginData(data);
},
error: (error) => {
console.error(error);
}
});
}
private handleLoginData(data: any) {
if (data["code"] != null) {