mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
reload after login fixed
This commit is contained in:
parent
6f8d39405a
commit
67393f50a7
@ -20,23 +20,24 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
console.log("mounted")
|
||||
console.log(" $cookies.get('gdd_session_id') ", $cookies.get("gdd_session_id") )
|
||||
console.log(" $cookies.isKey('gdd_session_id') ", $cookies.isKey("gdd_session_id") )
|
||||
const isSession = $cookies.isKey("gdd_session_id")
|
||||
const getSession = $cookies.get("gdd_session_id")
|
||||
console.log("this.isSession ", this.isSession )
|
||||
|
||||
if ( $cookies.isKey("gdd_session_id")) {
|
||||
//this.$store.state.email = this.$cookies.get('gdd_u')
|
||||
console.log("router to overview")
|
||||
this.$router.push("/overview")
|
||||
}else {
|
||||
console.log("router to LOGIN")
|
||||
//this.$router.push("/login")
|
||||
}
|
||||
},
|
||||
created () {
|
||||
console.log("created")
|
||||
console.log("created")
|
||||
|
||||
// console.log(" $cookies.get('gdd_session_id') ", $cookies.get("gdd_session_id") )
|
||||
console.log("app.vue $cookies.isKey('gdd_session_id') ", $cookies.isKey("gdd_session_id") )
|
||||
const isSession = $cookies.isKey("gdd_session_id")
|
||||
// const getSession = $cookies.get("gdd_session_id")
|
||||
// console.log("this.isSession ", this.isSession )
|
||||
console.log("xx", ( isSession == true))
|
||||
if ( $cookies.isKey("gdd_session_id") == true) {
|
||||
//this.$store.state.email = this.$cookies.get('gdd_u')
|
||||
console.log("app to overview")
|
||||
this.$router.push("overview")
|
||||
}else {
|
||||
console.log("router to LOGIN")
|
||||
//this.$router.push("/login")
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@ -3,7 +3,9 @@ import CONFIG from '../config'
|
||||
|
||||
const apiGet = async (url) => {
|
||||
try {
|
||||
console.log("comm api url",url)
|
||||
const result = await axios.get(url);
|
||||
console.log("comm api result",result)
|
||||
if(result.status !== 200){
|
||||
throw new Error('HTTP Status Error '+result.status)
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import router from '../routes/router.js'
|
||||
import loginAPI from '../apis/loginAPI'
|
||||
import communityAPI from '../apis/communityAPI'
|
||||
import axios from 'axios'
|
||||
import CONFIG from '../config'
|
||||
//import CONFIG from '../config'
|
||||
|
||||
|
||||
export const store = new Vuex.Store({
|
||||
@ -68,9 +68,7 @@ export const store = new Vuex.Store({
|
||||
actions: {
|
||||
login: async ({ dispatch, commit }, data) => {
|
||||
console.log('action: login')
|
||||
console.log('action: data', data.email)
|
||||
//console.log('action: CONFIG.LOGIN_API_URL', CONFIG.LOGIN_API_URL)
|
||||
|
||||
|
||||
axios.post("http://localhost/login_api/unsecureLogin/",
|
||||
{"email": data.email, "password":data.password }).then((result) => {
|
||||
console.log("store login result", result)
|
||||
@ -80,7 +78,7 @@ export const store = new Vuex.Store({
|
||||
console.log('result.data.session_id',result.data.session_id)
|
||||
|
||||
|
||||
if( result.data.state ){
|
||||
if( result.data.state == "success"){
|
||||
commit('session_id', result.data.session_id)
|
||||
commit('email', data.email)
|
||||
$cookies.set('gdd_session_id', result.data.session_id);
|
||||
@ -88,6 +86,7 @@ export const store = new Vuex.Store({
|
||||
router.push('/overview')
|
||||
} else {
|
||||
// Register failed, we perform a logout
|
||||
console.log('action login to logout start')
|
||||
dispatch('logout')
|
||||
}
|
||||
}, (error) => {
|
||||
@ -113,6 +112,7 @@ export const store = new Vuex.Store({
|
||||
router.push('/overview')
|
||||
} else {
|
||||
// Register failed, we perform a logout
|
||||
console.log('action createUser to logout start')
|
||||
dispatch('logout')
|
||||
}
|
||||
},
|
||||
@ -150,12 +150,18 @@ export const store = new Vuex.Store({
|
||||
// const result = await communityAPI.transactions(state.session_id)
|
||||
},
|
||||
accountBalance: async ({ commit, dispatch, state }) => {
|
||||
//console.log('action: accountBalance')
|
||||
const result = await communityAPI.balance(state.session_id)
|
||||
//console.log(result)
|
||||
console.log('action: accountBalance')
|
||||
console.log('action: dispatch', dispatch)
|
||||
console.log('action: state.session_id', state.session_id)
|
||||
console.log(" action: $cookies.get('gdd_session_id') ", $cookies.get("gdd_session_id") )
|
||||
commit('session_id', $cookies.get("gdd_session_id"))
|
||||
commit('email', $cookies.get("gdd_u"))
|
||||
const result = await communityAPI.balance($cookies.get("gdd_session_id"))
|
||||
console.log("accountBalance result", result)
|
||||
if(result.success) {
|
||||
commit('user_balance', result.result.data.balance)
|
||||
} else {
|
||||
console.log('action accountBalance to logout start')
|
||||
dispatch('logout')
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,11 +25,10 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import GddStatus from './KontoOverview/GddStatus.vue';
|
||||
import GddSent from './KontoOverview/GddSent.vue';
|
||||
import GddTable from './KontoOverview/GddTable.vue';
|
||||
//import GddAddWork from './KontoOverview/GddAddWork.vue';
|
||||
import GddAddWork2 from './KontoOverview/GddAddWork2.vue';
|
||||
import GddStatus from './KontoOverview/GddStatus.vue';
|
||||
import GddSent from './KontoOverview/GddSent.vue';
|
||||
import GddTable from './KontoOverview/GddTable.vue';
|
||||
import GddAddWork2 from './KontoOverview/GddAddWork2.vue';
|
||||
import GddWorkTable from './KontoOverview/GddWorkTable.vue';
|
||||
|
||||
export default {
|
||||
@ -38,13 +37,12 @@
|
||||
GddStatus,
|
||||
GddSent,
|
||||
GddTable,
|
||||
//GddAddWork,
|
||||
GddAddWork2,
|
||||
GddWorkTable
|
||||
},
|
||||
created() {
|
||||
this.$store.dispatch('accountBalance')
|
||||
},
|
||||
this.$store.dispatch('accountBalance', $cookies.get("gdd_session_id"))
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@ -41,25 +41,10 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { BaseNav } from '@/components';
|
||||
import { ZoomCenterTransition } from 'vue2-transitions';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
//BaseNav,
|
||||
//ZoomCenterTransition
|
||||
},
|
||||
props: {
|
||||
backgroundColor: {
|
||||
type: String,
|
||||
default: 'black'
|
||||
}
|
||||
},
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
showMenu: false,
|
||||
menuTransitionDuration: 250,
|
||||
pageTransitionDuration: 200,
|
||||
year: new Date().getFullYear(),
|
||||
pageClass: 'login-page'
|
||||
};
|
||||
@ -76,80 +61,10 @@
|
||||
// params: { lang: locale }
|
||||
//})
|
||||
//this.hideDropdown()
|
||||
},
|
||||
toggleNavbar() {
|
||||
document.body.classList.toggle('nav-open');
|
||||
this.showMenu = !this.showMenu;
|
||||
},
|
||||
closeMenu() {
|
||||
document.body.classList.remove('nav-open');
|
||||
this.showMenu = false;
|
||||
},
|
||||
setBackgroundColor() {
|
||||
document.body.classList.add('bg-default');
|
||||
},
|
||||
removeBackgroundColor() {
|
||||
document.body.classList.remove('bg-default');
|
||||
},
|
||||
updateBackground() {
|
||||
if (!this.$route.meta.noBodyBackground) {
|
||||
this.setBackgroundColor();
|
||||
} else {
|
||||
this.removeBackgroundColor()
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.removeBackgroundColor();
|
||||
},
|
||||
beforeRouteUpdate(to, from, next) {
|
||||
// Close the mobile menu first then transition to next page
|
||||
if (this.showMenu) {
|
||||
this.closeMenu();
|
||||
setTimeout(() => {
|
||||
next();
|
||||
}, this.menuTransitionDuration);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
immediate: true,
|
||||
handler: function () {
|
||||
this.updateBackground()
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
$scaleSize: 0.8;
|
||||
@keyframes zoomIn8 {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: scale3d($scaleSize, $scaleSize, $scaleSize);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.main-content .zoomIn {
|
||||
animation-name: zoomIn8;
|
||||
}
|
||||
|
||||
@keyframes zoomOut8 {
|
||||
from {
|
||||
opacity: 1;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
transform: scale3d($scaleSize, $scaleSize, $scaleSize);
|
||||
}
|
||||
}
|
||||
|
||||
.main-content .zoomOut {
|
||||
animation-name: zoomOut8;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@ -15,19 +15,7 @@
|
||||
</li>
|
||||
</b-navbar-nav>
|
||||
<b-navbar-nav class="align-items-center ml-auto ml-md-0">
|
||||
<!-- <b-form class="navbar-search form-inline mr-sm-3"
|
||||
:class="{'navbar-search-dark': type === 'default', 'navbar-search-light': type === 'light'}"
|
||||
id="navbar-search-main">
|
||||
<b-form-group class="mb-0">
|
||||
<b-input-group class="input-group-alternative input-group-merge">
|
||||
<b-form-input placeholder="Search" type="text"> </b-form-input>
|
||||
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fas fa-search"></i></span>
|
||||
</div>
|
||||
</b-input-group>
|
||||
</b-form-group>
|
||||
</b-form> -->
|
||||
<base-dropdown menu-on-right
|
||||
class="nav-item"
|
||||
tag="li"
|
||||
@ -38,7 +26,7 @@
|
||||
|
||||
<b-media-body class="ml-2 d-none d-lg-block">
|
||||
<span class="avatar avatar-sm rounded-circle">
|
||||
<vue-qrcode :value="$store.state.email" type="image/png"/>
|
||||
<!-- <vue-qrcode :value="$store.state.email" /> -->
|
||||
</span>
|
||||
<span class="mb-0 text-lg font-weight-bold">{{this.$store.state.email}}</span>
|
||||
</b-media-body>
|
||||
|
||||
@ -82,6 +82,18 @@
|
||||
onSubmit() {
|
||||
this.$store.dispatch('login', {"email": this.model.email, "password": this.model.password})
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
console.log("login.vue created")
|
||||
|
||||
if ( $cookies.isKey("gdd_session_id")) {
|
||||
//this.$store.state.email = this.$cookies.get('gdd_u')
|
||||
console.log("login to overview")
|
||||
this.$router.push("/overview")
|
||||
}else {
|
||||
console.log("login to LOGIN")
|
||||
//this.$router.push("/login")
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<b-col lg="3" class="order-lg-2">
|
||||
<div class="card-profile-image">
|
||||
<a href="#">
|
||||
<vue-qrcode :value="$store.state.email" type="image/png"/>
|
||||
<vue-qrcode :value="$store.state.email" />
|
||||
</a>
|
||||
</div>
|
||||
</b-col>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user