Login - move to env.js import

This commit is contained in:
Philipp Dormann 2020-12-20 17:28:35 +01:00
parent 98bc810e51
commit 8ef0b21819
2 changed files with 17 additions and 8193 deletions

8180
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -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,