mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
login + cookie set II
This commit is contained in:
parent
2bd96339ff
commit
fff03aa7bd
24
src/App.vue
24
src/App.vue
@ -3,9 +3,6 @@
|
||||
<header class="border-t-4 border-blue-700 bg-white z-10 absolute w-full shadow-md">
|
||||
</header>
|
||||
<div class="bg-gray-100 min-h-screen pt-40 text-lg">
|
||||
<!--<b-row v-show="this.$cookies.get('gdd_is_auth') == 'true'" class="justify-content-center">
|
||||
<base-button type="warning" @click="logout">{{this.$store.state.user.email}} - Logout</base-button>
|
||||
</b-row>-->
|
||||
<router-view />
|
||||
</div>
|
||||
</div>
|
||||
@ -16,37 +13,40 @@
|
||||
export default {
|
||||
name: 'app',
|
||||
created () {
|
||||
if (this.$cookies.get('gdd_is_auth') == 'true') {
|
||||
if (this.$cookies.get('gdd_is_auth') == 'true' && this.$store.state.is_auth == true) {
|
||||
this.$store.state.user.email = this.$cookies.get('gdd_email')
|
||||
this.$router.push('/KontoOverview')
|
||||
|
||||
// if ( this.$store.state.is_auth == false && this.$store.state.is_admin == false) {
|
||||
// this.$router.push("/Landing")
|
||||
// } else {
|
||||
this.$router.push('/KontoOverview')
|
||||
// }
|
||||
}else {
|
||||
this.$router.push("/Landing")
|
||||
}
|
||||
//if ( this.$store.state.is_auth == false && this.$store.state.is_admin == false) {
|
||||
// this.$router.push("/Landing")
|
||||
//}
|
||||
|
||||
//var user = { id:1, name:'Journal',session:'25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX' };
|
||||
//this.$cookies.set('user',user);
|
||||
//// print user name
|
||||
console.log("APP.vue START created get cookie is_auth=>",this.$cookies.get('gdd_is_auth'))
|
||||
//console.log("APP.vue START created get cookie is_auth=>",this.$cookies.get('gdd_is_auth'))
|
||||
|
||||
},
|
||||
methods: {
|
||||
/*
|
||||
login() {
|
||||
console.log("app.vue user login() : " + this.$store.state.is_auth)
|
||||
//console.log("app.vue user login() : " + this.$store.state.is_auth)
|
||||
this.$store.commit('login')
|
||||
//this.$router.push('/KontoOverview')
|
||||
},
|
||||
loginAsAdmin () {
|
||||
console.log("app.vue admin login(): " + this.$store.state.is_admin)
|
||||
// console.log("app.vue admin login(): " + this.$store.state.is_admin)
|
||||
this.$store.state.modals = true
|
||||
//this.$store.commit('loginAsAdmin')
|
||||
//this.$router.push('/AdminOverview')
|
||||
},
|
||||
|
||||
logout(){
|
||||
console.log("app.vue user logout() : ")
|
||||
// console.log("app.vue user logout() : ")
|
||||
this.$store.commit('logout')
|
||||
}
|
||||
*/
|
||||
|
||||
@ -28,9 +28,9 @@ router.beforeEach((to, from, next) => {
|
||||
}
|
||||
|
||||
//console.log("----------------")
|
||||
console.log("ROUTER.js to", to)
|
||||
console.log("ROUTER.js store.state.is_auth", store.state.is_auth)
|
||||
console.log("ROUTER.js store.commit('isActive')", store.commit('isActive'))
|
||||
//("ROUTER.js to", to)
|
||||
//console.log("ROUTER.js store.state.is_auth", store.state.is_auth)
|
||||
//console.log("ROUTER.js store.commit('isActive')", store.commit('isActive'))
|
||||
|
||||
//if (store.commit('isActive') ) {
|
||||
// next()
|
||||
|
||||
@ -57,13 +57,14 @@ export const store = new Vuex.Store({
|
||||
//}
|
||||
// console.log("STORE login() to " + state.is_auth)
|
||||
},
|
||||
creatUser( formdata) {
|
||||
creatUser( state, formdata) {
|
||||
//console.log("Im Store creatUser() start " )
|
||||
axios.post("http://localhost/login_api/createUser", formdata).then((ldata) => {
|
||||
|
||||
//console.log("Im Store creatUser() axios then ", ldata);
|
||||
// this.ldata = ldata.data;
|
||||
//return true
|
||||
console.log("Im Store creatUser() axios then ", ldata);
|
||||
// this.ldata = ldata.data;
|
||||
return true
|
||||
|
||||
}, (error) => {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
@ -52,6 +52,7 @@ import DashboardContent from '../Layout/Content.vue';
|
||||
import { FadeTransition } from 'vue2-transitions';
|
||||
|
||||
export default {
|
||||
props: [],
|
||||
components: {
|
||||
DashboardNavbar,
|
||||
ContentFooter,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user