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