Login bug fix for OOP and module bundling architecture complete.
This commit is contained in:
2
static/dist/js/main.bundle.js
vendored
2
static/dist/js/main.bundle.js
vendored
File diff suppressed because one or more lines are too long
@@ -40,18 +40,19 @@ export default class API {
|
||||
if (hash == null) hash = hashPageHome;
|
||||
console.log("getUrlFromHash:");
|
||||
console.log("base url: " + _pathHost + "\nhash: " + hash + '\nparams: ' + params);
|
||||
let url = _pathHost + hash;
|
||||
if (params) {
|
||||
url += '?' + new URLSearchParams(params).toString();
|
||||
}
|
||||
let url = API.parameteriseUrl(_pathHost + hash, params);
|
||||
console.log("url: " + url);
|
||||
return url;
|
||||
}
|
||||
|
||||
static parameteriseUrl(url, params) {
|
||||
if (params) {
|
||||
url += '?' + new URLSearchParams(params).toString();
|
||||
}
|
||||
return url;
|
||||
}
|
||||
static goToUrl(url) {
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
static goToHash(hash, params = null) {
|
||||
const url = API.getUrlFromHash(hash, params);
|
||||
API.goToUrl(url);
|
||||
|
||||
@@ -131,6 +131,7 @@ export default class BasePage {
|
||||
console.log('sending data to user login controller: ');
|
||||
console.log(dataRequest);
|
||||
*/
|
||||
// let page = this;
|
||||
API.loginUser()
|
||||
.then((response) => {
|
||||
if (response.Success) {
|
||||
|
||||
@@ -179,6 +179,12 @@ export default class Router {
|
||||
const pageCurrent = new ClassPageCurrent(this);
|
||||
pageCurrent.leave();
|
||||
}
|
||||
navigateToUrl(url, data = null, appendHistory = true) {
|
||||
this.beforeLeave();
|
||||
if (appendHistory) history.pushState(data, '', url);
|
||||
url = API.parameteriseUrl(url, data);
|
||||
API.goToUrl(url);
|
||||
}
|
||||
|
||||
/*
|
||||
static getPages() {
|
||||
@@ -222,12 +228,6 @@ export default class Router {
|
||||
this.navigateToUrl(url, data);
|
||||
}
|
||||
|
||||
navigateToUrl(url, data = null, appendHistory = true) {
|
||||
this.leavePageCurrent();
|
||||
if (appendHistory) history.pushState(data, '', url);
|
||||
url = Router.parameteriseUrl(url, data);
|
||||
Router.#goToUrl(url);
|
||||
}
|
||||
|
||||
leavePageCurrent() {
|
||||
const pageCurrent = Router.getPageCurrent();
|
||||
|
||||
Reference in New Issue
Block a user