Fix redirect after login

This commit is contained in:
Lucio Maranta
2019-09-11 16:05:28 +02:00
parent f256a4e0f3
commit cbafff3bb9
2 changed files with 11 additions and 6 deletions
@@ -37,9 +37,16 @@ export default class Login extends Vue {
})
if(this.logginIn) {
if(userNotAuthorized)
this.$router.push('/production')
if(userNotAuthorized){
// If not authorized redirect to the first available page
for(var k in this.URLS_TO_FUNCTIONS_BINDING){
if(machineStatusActions.isAreaVisible(store, this.URLS_TO_FUNCTIONS_BINDING[k])){
this.$router.push(this.URLS_TO_FUNCTIONS_BINDING[k])
break;
}
}
}
ModalHelper.HideModal("modal-login");
}
}
+1 -3
View File
@@ -1,7 +1,7 @@
import { baseRestService, AuthToken, to } from "src/_base/baseRestService";
import Factory from "src/_base/factoryService";
import { store, appModelActions,machineStatusActions } from "src/store";
import { store, appModelActions, machineStatusActions } from "src/store";
import { machineService } from "./machineService";
import {Hub} from "src/services/hub"
@@ -9,8 +9,6 @@ import {Hub} from "src/services/hub"
class LoginService extends baseRestService {
public isAuthenticated: boolean = false;
$route: any;
$router: any;
constructor() {
super();