Bladeren bron

fix: login and sign up stuff

pull/65/head
Tyler Chen 4 jaren geleden
bovenliggende
commit
40efcf1de8
1 gewijzigde bestanden met toevoegingen van 18 en 10 verwijderingen
  1. +18
    -10
      src/_pages/Layout.vue

+ 18
- 10
src/_pages/Layout.vue Bestand weergeven

@@ -59,6 +59,7 @@ export default {
...mapActions('paymentMethods', ['getAllAccountPaymentMethods']), ...mapActions('paymentMethods', ['getAllAccountPaymentMethods']),


initDefaults() { initDefaults() {
this.currentUser = util.currentUser();
const selectedLocale = const selectedLocale =
this.currentUser !== null && this.currentUser !== null &&
typeof this.currentUser.locale !== 'undefined' && typeof this.currentUser.locale !== 'undefined' &&
@@ -82,6 +83,14 @@ export default {
(!this.configs.paymentsEnabled || (!this.configs.paymentsEnabled ||
this.hasPaymentMethod === true || this.hasPaymentMethod === true ||
this.$route.path === '/payment')); this.$route.path === '/payment'));

console.log(
'initDefaults',
!this.currentUser,
this.$route.path,
!!this.verifiedContacts,
this.currentUser && !!this.currentUser.admin
);
}, },


hasVerifiedContact(policy) { hasVerifiedContact(policy) {
@@ -120,20 +129,15 @@ export default {


watch: { watch: {
$route() { $route() {
this.isPageAvailable =
!this.currentUser ||
this.$route.path === '/me/action' ||
this.$route.path === '/logout' ||
this.$route.path === '/verifyEmail' ||
((this.verifiedContacts || this.currentUser.admin) &&
(!this.configs.paymentsEnabled ||
this.hasPaymentMethod === true ||
this.$route.path === '/payment'));
this.$nextTick(() => {
this.initDefaults();
});
}, },


policy(p) { policy(p) {
this.verifiedContacts = this.hasVerifiedContact(p); this.verifiedContacts = this.hasVerifiedContact(p);
const currentUser = util.currentUser(); const currentUser = util.currentUser();
if (!currentUser) return;
if (!this.verifiedContacts && !currentUser.admin) { if (!this.verifiedContacts && !currentUser.admin) {
this.navigateToVerifyEmail(); this.navigateToVerifyEmail();
if (this.verifiedContactRefresher === null) { if (this.verifiedContactRefresher === null) {
@@ -162,7 +166,11 @@ export default {
}, },


accountPaymentMethods(pms, oldpms) { accountPaymentMethods(pms, oldpms) {
if (pms && this.configs.paymentsEnabled) {
if (
pms &&
this.configs.paymentsEnabled &&
(this.verifiedContacts || (this.currentUser && this.currentUser.admin))
) {
const payMethods = []; const payMethods = [];
for (let i = 0; i < pms.length; i++) { for (let i = 0; i < pms.length; i++) {
const pm = pms[i]; const pm = pms[i];


Laden…
Annuleren
Opslaan