gamebrary/src/components/SessionExpiredModal.vue

64 lines
1.4 KiB
Vue
Raw Normal View History

2020-10-14 21:48:27 +00:00
<!-- TODO: translate -->
2020-09-23 23:01:39 +00:00
<template lang="html">
<b-modal
centered
cancel-title="Sign out"
cancel-variant="primary"
ok-title="Authenticate with Google"
ok-variant="success"
2020-10-09 18:21:43 +00:00
hide-header-close
2020-09-23 23:01:39 +00:00
@ok="login"
@cancel="logout"
no-close-on-backdrop
v-model="sessionExpired"
>
2020-10-14 00:36:15 +00:00
<template v-slot:modal-header="{ close }">
<modal-header
title="Uh oh!"
2020-10-14 21:48:27 +00:00
@close="close"
/>
2020-10-14 00:36:15 +00:00
</template>
2020-09-23 23:01:39 +00:00
Your session has expired.
</b-modal>
</template>
<script>
import { mapState } from 'vuex';
export default {
computed: {
...mapState(['sessionExpired']),
publicPageUrl() {
// TODO: move to getter and replace other instances
return process.env.NODE_ENV === 'development'
? 'http://localhost:3000'
: 'https://gamebrary.com';
},
authUrl() {
// TODO: move to getter and replace other instances
return process.env.NODE_ENV === 'development'
? 'http://localhost:4000'
: 'https://app.gamebrary.com';
},
},
methods: {
login() {
this.$store.commit('CLEAR_SESSION');
this.$store.commit('SET_SESSION_EXPIRED', false);
window.location.href = this.authUrl;
},
logout() {
this.$store.commit('CLEAR_SESSION');
this.$store.commit('SET_SESSION_EXPIRED', false);
window.location.href = this.publicPageUrl;
},
},
};
</script>