Skip to content

Commit

Permalink
refactor(Proof add): on Proof add success, redirect to dashboard. ref #…
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Oct 7, 2024
1 parent 8816898 commit ffe8c13
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
11 changes: 0 additions & 11 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@
</v-col>
</v-row>

<v-snackbar
v-model="proofSingleSuccessMessage"
color="success"
:timeout="2000"
>
{{ $t('ProofCreate.Success') }}
</v-snackbar>
<v-snackbar
v-model="settingsSuccessMessage"
color="success"
Expand Down Expand Up @@ -67,7 +60,6 @@ export default {
totalPriceCount: null,
loading: false,
// success messages
proofSingleSuccessMessage: false,
settingsSuccessMessage: false,
}
},
Expand All @@ -85,9 +77,6 @@ export default {
}
},
mounted() {
if (this.$route.query.proofSingleSuccess === 'true') {
this.proofSingleSuccessMessage = true
}
if (this.$route.query.settingsSuccess === 'true') {
this.settingsSuccessMessage = true
}
Expand Down
5 changes: 4 additions & 1 deletion src/views/ProofAddSingle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,17 @@ export default {
this.loading = true
api.updateProof(this.addProofSingleForm.proof_id, this.addProofSingleForm)
.then(() => {
this.$router.push({ path: '/', query: { proofSingleSuccess: 'true' } })
this.done()
})
.catch(err => {
this.$store.app.showError(err)
})
.finally(() => {
this.loading = false
})
},
done() {
this.$router.push({ path: '/dashboard', query: { proofSingleSuccess: 'true' } })
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/views/UserDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
>
{{ $t('Common.Thanks') }}
</v-snackbar>
<v-snackbar
v-model="proofSingleSuccessMessage"
color="success"
:timeout="2000"
>
{{ $t('ProofCreate.Success') }}
</v-snackbar>
</template>

<script>
Expand All @@ -68,6 +75,7 @@ export default {
// success messages
singleSuccessMessage: false,
multipleSuccessMessage: false,
proofSingleSuccessMessage: false,
}
},
computed: {
Expand All @@ -94,6 +102,9 @@ export default {
if (this.$route.query.multipleSuccess === 'true') {
this.multipleSuccessMessage = true
}
if (this.$route.query.proofSingleSuccess === 'true') {
this.proofSingleSuccessMessage = true
}
},
methods: {
getUser() {
Expand Down

0 comments on commit ffe8c13

Please sign in to comment.