Login - move to env.js import
This commit is contained in:
parent
98bc810e51
commit
8ef0b21819
8180
package-lock.json
generated
8180
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,17 +1,17 @@
|
||||
<script>
|
||||
import { _ } from "svelte-i18n";
|
||||
import store from "../store.js";
|
||||
import { _ } from "svelte-i18n";
|
||||
import { config } from "../dev.env";
|
||||
store.init();
|
||||
import {push, pop, replace} from 'svelte-spa-router'
|
||||
import { push, pop, replace } from "svelte-spa-router";
|
||||
//
|
||||
import { OpenAPI, AuthService } from "@odit/lfk-client-js";
|
||||
OpenAPI.BASE = "http://localhost:4010";
|
||||
//
|
||||
OpenAPI.BASE = config.baseurl;
|
||||
//
|
||||
import Toastify from "toastify-js";
|
||||
import "toastify-js/src/toastify.css";
|
||||
let usersUsername = "";
|
||||
let usersPassword = "";
|
||||
let usersUsername,
|
||||
usersPassword = "";
|
||||
let last_loginclick_processed = true;
|
||||
|
||||
const login = async () => {
|
||||
@ -22,18 +22,22 @@
|
||||
text: $_("login_is_checked"),
|
||||
duration: 500,
|
||||
}).showToast();
|
||||
console.log(usersUsername);
|
||||
console.log(usersPassword);
|
||||
let username = usersUsername;
|
||||
let password = usersPassword;
|
||||
if (username.length == 0) {
|
||||
username = config.default_username || "demo";
|
||||
}
|
||||
if (password.length == 0) {
|
||||
password = config.default_password || "demo";
|
||||
}
|
||||
AuthService.authControllerLogin({
|
||||
username: "demo",
|
||||
password: "demo",
|
||||
// username: usersUsername,
|
||||
// password: usersPassword,
|
||||
username,
|
||||
password,
|
||||
})
|
||||
.then((result) => {
|
||||
OpenAPI.TOKEN = result.access_token;
|
||||
store.login(result.access_token);
|
||||
replace('/dashboard/')
|
||||
replace("/dashboard/");
|
||||
Toastify({
|
||||
text: $_("welcome_wavinghand"),
|
||||
duration: 500,
|
||||
|
Loading…
x
Reference in New Issue
Block a user