Skip to content
Snippets Groups Projects
Commit 37acc12d authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Bugfix: VOAPP-89

parent b48adb56
No related branches found
No related tags found
No related merge requests found
...@@ -43,13 +43,11 @@ export default { ...@@ -43,13 +43,11 @@ export default {
}, },
methods: { methods: {
}, },
mounted(){ beforeMount(){
/*let userUUID = localStorage.getItem(CommonUtil.CONST_STORAGE_UUID);
let userUUID = localStorage.getItem(CommonUtil.CONST_STORAGE_UUID); console.info("Checking UUID on start: " + userUUID);
this.$root.sharedState.uuid = userUUID; this.$root.sharedState.uuid = userUUID;*/
} }
} }
</script> </script>
......
...@@ -109,19 +109,19 @@ export default { ...@@ -109,19 +109,19 @@ export default {
/** Get user details from local storage */ /** Get user details from local storage */
getUserFromStorage() { getUserFromStorage() {
let strUser = localStorage.getItem(CommonUtil.CONST_STORAGE_USER_DETAIL); let strUser = localStorage.getItem(CommonUtil.CONST_STORAGE_USER_DETAIL);
if(strUser && strUser != 'undefined') if(strUser && strUser != 'undefined')
{ {
let user = JSON.parse(strUser); let user = JSON.parse(strUser);
this.appUser = user; //This user will require in Sync process this.appUser = user; //This user will require in Sync process
this.$root.sharedState.uuid = user.userUuid; this.$root.sharedState.uuid = user.userUuid;
this.$root.sharedState.user.firstName = user.firstName; this.$root.sharedState.user.firstName = user.firstName;
this.$root.sharedState.user.lastName = user.lastName; this.$root.sharedState.user.lastName = user.lastName;
this.userLoggedInName = this.$root.sharedState.user.firstName + " " + this.$root.sharedState.user.lastName; this.userLoggedInName = this.$root.sharedState.user.firstName + " " + this.$root.sharedState.user.lastName;
} }
/** Firing event to parent (main.js) */ /** Firing event to parent (main.js) */
//this.$emit(CommonUtil.CONST_EVENT_LOGIN_USER_DETAIL,user.userUuid, user.firstName,user.lastName); //this.$emit(CommonUtil.CONST_EVENT_LOGIN_USER_DETAIL,user.userUuid, user.firstName,user.lastName);
}, },
/** Check uuid first */ /** Check uuid first */
...@@ -137,7 +137,7 @@ export default { ...@@ -137,7 +137,7 @@ export default {
headers: jsonHeader, headers: jsonHeader,
}).then((response) => { }).then((response) => {
if (response.status != 200 || response.status != 201) { if (response.status != 200 && response.status != 201) {
this.$root.sharedState.uuid = ''; this.$root.sharedState.uuid = '';
} else { } else {
...@@ -218,6 +218,10 @@ export default { ...@@ -218,6 +218,10 @@ export default {
// Setting the UUID causes the App.vue component to use observationlist as template // Setting the UUID causes the App.vue component to use observationlist as template
// So there's no need to navigate manually // So there's no need to navigate manually
localStorage.setItem(CommonUtil.CONST_STORAGE_UUID,uuid); localStorage.setItem(CommonUtil.CONST_STORAGE_UUID,uuid);
if(this.$router.currentRoute.path != "/")
{
this.$router.push('/')
}
} }
} }
); // END inner fetch ); // END inner fetch
......
...@@ -44,15 +44,14 @@ export default ({ ...@@ -44,15 +44,14 @@ export default ({
data() data()
{ {
return { return {
isMounted : false,
uuid : '',
} }
}, },
methods: { methods: {
}, },
mounted() { mounted() {
this.isMounted = true; //this.isMounted = true;
//this.uuid = localStorage.getItem(localStorage.removeItem(CommonUtil.CONST_STORAGE_UUID)); //this.uuid = localStorage.getItem(localStorage.removeItem(CommonUtil.CONST_STORAGE_UUID));
//console.log('uuid : '+this.uuid); //console.log('uuid : '+this.uuid);
......
...@@ -37,16 +37,18 @@ const init = () => { ...@@ -37,16 +37,18 @@ const init = () => {
}, },
i18n, i18n,
created() { created() {
console.info("Vue is ready"); console.info("Vue is ready");
console.info("User's preferred language is " + navigator.language); console.info("User's preferred language is " + navigator.language);
// Are we logged in already?
} }
}); });
}; };
/** /**
* Hope this works. It's for adding router functionality to the menu, * Adding router functionality to the menu,
* which is outside the main app * which is outside the main app
*/ */
new Vue({ new Vue({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment