parent
e838e6f321
commit
076893981f
@ -5,6 +5,7 @@
|
||||
store.init();
|
||||
import { OpenAPI, AuthService } from "@odit/lfk-client-js";
|
||||
import Footer from "../general/Footer.svelte";
|
||||
import isEmail from "validator/es/lib/isEmail";
|
||||
import Toastify from "toastify-js";
|
||||
// ------
|
||||
let username = config.default_username || "";
|
||||
@ -36,10 +37,19 @@
|
||||
text: $_("login_is_checked"),
|
||||
duration: 500,
|
||||
}).showToast();
|
||||
AuthService.authControllerLogin({
|
||||
username,
|
||||
password,
|
||||
})
|
||||
let postdata = {};
|
||||
if (isEmail(username)) {
|
||||
postdata = {
|
||||
email: username,
|
||||
password,
|
||||
};
|
||||
} else {
|
||||
postdata = {
|
||||
username,
|
||||
password,
|
||||
};
|
||||
}
|
||||
AuthService.authControllerLogin(postdata)
|
||||
.then(async (result) => {
|
||||
await localForage.setItem("logindata", result);
|
||||
OpenAPI.TOKEN = result.access_token;
|
||||
|
Loading…
x
Reference in New Issue
Block a user