Skip to content

Commit

Permalink
refactor(proof store): disable proof store because of inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Jun 24, 2024
1 parent 7701ec7 commit 81f2731
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
3 changes: 0 additions & 3 deletions src/components/ProofDeleteConfirmationDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

<script>
import { defineAsyncComponent } from 'vue'
import { useAppStore } from '../store'
import api from '../services/api'
export default {
Expand Down Expand Up @@ -63,8 +62,6 @@ export default {
// if response.status == 204
this.loading = false
this.deleteSuccessMessage = true
const store = useAppStore()
store.removeProof(this.proof.id)
this.$emit('delete')
this.closeDialog()
})
Expand Down
3 changes: 0 additions & 3 deletions src/components/ProofEditDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@

<script>
import { defineAsyncComponent } from 'vue'
import { useAppStore } from '../store'
import api from '../services/api'
export default {
Expand Down Expand Up @@ -85,8 +84,6 @@ export default {
.updateProof(this.proof.id, this.updateProofForm)
.then((response) => {
// if response.status == 204
const store = useAppStore()
store.updateProof(this.proof.id, this.updateProofForm)
this.$emit('update', response.data)
this.close()
})
Expand Down
2 changes: 0 additions & 2 deletions src/components/ProofInputRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ export default {
.then((data) => {
this.loading = false
if (data.id) {
const store = useAppStore()
store.addProof(data)
this.proofForm.proof_id = data.id
this.proofObject = {...data, ...{location: this.locationObject}}
this.proofSuccessMessage = true
Expand Down
15 changes: 9 additions & 6 deletions src/views/UserDashboardProofList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
{{ $t('UserDashboard.LatestProofs') }}
<v-progress-circular v-if="loading" indeterminate :size="30" />
</h2>

<v-row>
<v-col v-for="proof in appStore.user.proofs" :key="proof" cols="12" sm="6" md="4">
<ProofCard :proof="proof" :hideProofHeader="true" :isEditable="true" height="100%" @proofUpdated="handleProofUpdated" />
<v-col v-for="proof in userProofList" :key="proof" cols="12" sm="6" md="4">
<ProofCard :proof="proof" :hideProofHeader="true" height="100%" @proofUpdated="handleProofUpdated" />
</v-col>
</v-row>
<v-row v-if="appStore.user.proofs.length < appStore.getUserProofTotal" class="mb-2">

<v-row v-if="userProofList.length < userProofTotal" class="mb-2">
<v-col align="center">
<v-btn size="small" :loading="loading" @click="getUserProofs">
{{ $t('UserDashboard.LoadMore') }}
Expand Down Expand Up @@ -54,6 +56,8 @@ export default {
},
data() {
return {
userProofList: [],
userProofTotal: null,
userProofPage: 0,
loading: false,
proofUpdated: false
Expand All @@ -74,9 +78,8 @@ export default {
this.userProofPage += 1
return api.getProofs({ owner: this.username, page: this.userProofPage })
.then((data) => {
data.items.forEach(proof => this.appStore.addProof(proof))
this.appStore.user.proofs.sort((a, b) => new Date(b.created) - new Date(a.created))
this.appStore.setProofTotal(data.total)
this.userProofList.push(...data.items)
this.userProofTotal = data.total
this.loading = false
})
},
Expand Down

0 comments on commit 81f2731

Please sign in to comment.