Pārlūkot izejas kodu

fix: login and sign up stuff

pull/65/head
Tyler Chen pirms 4 gadiem
vecāks
revīzija
40efcf1de8
1 mainītis faili ar 18 papildinājumiem un 10 dzēšanām
  1. +18
    -10
      src/_pages/Layout.vue

+ 18
- 10
src/_pages/Layout.vue Parādīt failu

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

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

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

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

watch: {
$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) {
this.verifiedContacts = this.hasVerifiedContact(p);
const currentUser = util.currentUser();
if (!currentUser) return;
if (!this.verifiedContacts && !currentUser.admin) {
this.navigateToVerifyEmail();
if (this.verifiedContactRefresher === null) {
@@ -162,7 +166,11 @@ export default {
},

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


Notiek ielāde…
Atcelt
Saglabāt