Skip to content

Commit

Permalink
New filterType prop
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed May 27, 2024
1 parent a28b429 commit 97f9852
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/components/UserRecentProofsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,18 @@ export default {
components: {
ProofCard: defineAsyncComponent(() => import('../components/ProofCard.vue')),
},
props: {
filterType: {
type: String,
default: null,
}
},
emits: ['recentProofSelected', 'close'],
data() {
return {
userProofList: [],
userProofTotal: null,
userProofPage: 0,
userProofType: this.$route.path.endsWith('/receipt') ? 'RECEIPT' : 'PRICE_TAG',
loading: false,
selectedProof: null,
}
Expand All @@ -49,6 +54,13 @@ export default {
username() {
return this.appStore.user.username
},
getProofParams() {
let defaultParams = { owner: this.username, page: this.userProofPage }
if (this.filterType) {
defaultParams['type'] = this.filterType
}
return defaultParams
}
},
mounted() {
this.getUserProofs()
Expand All @@ -57,7 +69,7 @@ export default {
getUserProofs() {
this.loading = true
this.userProofPage += 1
return api.getProofs({ owner: this.username, page: this.userProofPage, type: this.userProofType })
return api.getProofs(this.getProofParams)
.then((data) => {
this.userProofList.push(...data.items)
this.userProofTotal = data.total
Expand Down
1 change: 1 addition & 0 deletions src/views/AddPriceMultiple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@
<UserRecentProofsDialog
v-if="userRecentProofsDialog"
v-model="userRecentProofsDialog"
:filterType="proofType"
@recentProofSelected="handleRecentProofSelected($event)"
@close="userRecentProofsDialog = false"
/>
Expand Down

0 comments on commit 97f9852

Please sign in to comment.