v1.7 beta.3

This commit is contained in:
carodej
2020-07-16 16:51:27 +02:00
parent abe7f0dafd
commit 59b6dfb841
11 changed files with 187 additions and 45 deletions

View File

@@ -59,6 +59,12 @@
</div>
</div>
<div class="form-group" v-if="isError">
<InfoBox type="error" style="margin-top: 40px">
<p>{{ errorMessage }}</p>
</InfoBox>
</div>
<div class="form-group">
<ButtonBase :disabled="isLoading" :loading="isLoading" button-style="theme" type="submit">
{{ $t('admin_page_plans.create_plan_button') }}
@@ -79,6 +85,7 @@
import SectionTitle from '@/components/Others/SectionTitle'
import ButtonBase from '@/components/FilesView/ButtonBase'
import PageHeader from '@/components/Others/PageHeader'
import InfoBox from '@/components/Others/Forms/InfoBox'
import {required} from 'vee-validate/dist/rules'
import {mapGetters} from 'vuex'
import {events} from "@/bus"
@@ -97,10 +104,13 @@
PageHeader,
FormLabel,
required,
InfoBox,
},
data() {
return {
isLoading: false,
errorMessage: '',
isError: false,
plan: {
name: '',
price: '',
@@ -141,20 +151,16 @@
// Validation errors
if (error.response.status == 422) {
// Password validation error
if (error.response.data.errors['storage_capacity']) {
this.$refs.createPlan.setErrors({
'storage capacity': this.$t('errors.capacity_digit')
});
}
}
} else {
events.$emit('alert:open', {
title: this.$t('popup_error.title'),
message: this.$t('popup_error.message'),
})
if (error.response.status == 500) {
this.isError = true
this.errorMessage = error.response.data.message
}
}).finally(() => {

View File

@@ -156,7 +156,6 @@
})
.catch(error => {
if (error.response.status == 401) {
if (error.response.data.error === 'invalid_client') {

View File

@@ -74,11 +74,14 @@
</ButtonBase>
</div>
<InfoBox v-if="isError" type="error" style="margin-top: 40px">
<p>{{ errorMessage }}</p>
</InfoBox>
<div class="submit-wrapper">
<AuthButton icon="chevron-right" :text="submitButtonText" :loading="isLoading"
:disabled="isLoading"/>
</div>
</ValidationObserver>
</AuthContent>
</AuthContentWrapper>
@@ -123,6 +126,8 @@
data() {
return {
isLoading: false,
isError: false,
errorMessage: '',
subscriptionPlans: [
{
id: 1,
@@ -147,23 +152,27 @@
// Start loading
this.isLoading = true
this.isError = false
// Send request to get verify account
axios
.post('/api/setup/stripe-plans', {
plans: this.subscriptionPlans
})
.then(response => {
// End loading
this.isLoading = false
.then(() => {
// Redirect to next step
this.$router.push({name: 'EnvironmentSetup'})
})
.catch(error => {
// End loading
if (error.response.status = 500) {
this.isError = true
this.errorMessage = error.response.data.message
}
})
.finally(() => {
this.isLoading = false
})
},

View File

@@ -11,8 +11,8 @@
...mapGetters(['config']),
},
mounted() {
if (this.config.installation === 'setup-done' || this.config.installation === 'quiet-update')
this.$router.push({name: 'SignIn'})
//if (this.config.installation === 'setup-done' || this.config.installation === 'quiet-update')
//this.$router.push({name: 'SignIn'})
}
}
</script>