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>
|
<script>
|
||||||
import { _ } from "svelte-i18n";
|
|
||||||
import store from "../store.js";
|
import store from "../store.js";
|
||||||
|
import { _ } from "svelte-i18n";
|
||||||
|
import { config } from "../dev.env";
|
||||||
store.init();
|
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";
|
import { OpenAPI, AuthService } from "@odit/lfk-client-js";
|
||||||
OpenAPI.BASE = "http://localhost:4010";
|
OpenAPI.BASE = config.baseurl;
|
||||||
//
|
|
||||||
//
|
//
|
||||||
import Toastify from "toastify-js";
|
import Toastify from "toastify-js";
|
||||||
import "toastify-js/src/toastify.css";
|
import "toastify-js/src/toastify.css";
|
||||||
let usersUsername = "";
|
let usersUsername,
|
||||||
let usersPassword = "";
|
usersPassword = "";
|
||||||
let last_loginclick_processed = true;
|
let last_loginclick_processed = true;
|
||||||
|
|
||||||
const login = async () => {
|
const login = async () => {
|
||||||
@ -22,18 +22,22 @@
|
|||||||
text: $_("login_is_checked"),
|
text: $_("login_is_checked"),
|
||||||
duration: 500,
|
duration: 500,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
console.log(usersUsername);
|
let username = usersUsername;
|
||||||
console.log(usersPassword);
|
let password = usersPassword;
|
||||||
|
if (username.length == 0) {
|
||||||
|
username = config.default_username || "demo";
|
||||||
|
}
|
||||||
|
if (password.length == 0) {
|
||||||
|
password = config.default_password || "demo";
|
||||||
|
}
|
||||||
AuthService.authControllerLogin({
|
AuthService.authControllerLogin({
|
||||||
username: "demo",
|
username,
|
||||||
password: "demo",
|
password,
|
||||||
// username: usersUsername,
|
|
||||||
// password: usersPassword,
|
|
||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
OpenAPI.TOKEN = result.access_token;
|
OpenAPI.TOKEN = result.access_token;
|
||||||
store.login(result.access_token);
|
store.login(result.access_token);
|
||||||
replace('/dashboard/')
|
replace("/dashboard/");
|
||||||
Toastify({
|
Toastify({
|
||||||
text: $_("welcome_wavinghand"),
|
text: $_("welcome_wavinghand"),
|
||||||
duration: 500,
|
duration: 500,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user