-
- {{ item }}
+ {{ items.length }}
+
+
+
diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue
new file mode 100644
index 000000000..11cb2266e
--- /dev/null
+++ b/frontend/src/components/Contributions/ContributionListItem.vue
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+ {{ amount | GDD }}
+
+ {{ $t('math.minus') }}
+
{{ $d(new Date(date), 'short') }}
+
+
{{ memo }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/pages/Community.vue b/frontend/src/pages/Community.vue
index c639ec969..6db97b5a0 100644
--- a/frontend/src/pages/Community.vue
+++ b/frontend/src/pages/Community.vue
@@ -6,12 +6,15 @@
-
-
-
-
-
+
+
@@ -20,7 +23,7 @@
import ContributionForm from '@/components/Contributions/ContributionForm.vue'
import ContributionList from '@/components/Contributions/ContributionList.vue'
import { createContribution } from '@/graphql/mutations'
-import { listContributions } from '@/graphql/queries'
+import { listContributions, verifyLogin } from '@/graphql/queries'
export default {
name: 'Community',
@@ -30,9 +33,10 @@ export default {
},
data() {
return {
+ items: [],
currentPage: 1,
pageSize: 25,
- items: [],
+ contributionCount: 0,
}
},
methods: {
@@ -51,19 +55,24 @@ export default {
.then((result) => {
// console.log('result', result.data)
this.toastSuccess(result.data)
+ this.updateListContributions({
+ currentPage: this.currentPage,
+ pageSize: this.pageSize,
+ })
+ this.verifyLogin()
})
.catch((err) => {
this.toastError(err.message)
})
},
- getListContributions(data) {
+ async updateListContributions(pagination) {
this.$apollo
.query({
fetchPolicy: 'no-cache',
query: listContributions,
variables: {
- currentPage: this.currentPage,
- pageSize: this.pageSize,
+ currentPage: pagination.currentPage,
+ pageSize: pagination.pageSize,
},
})
.then((result) => {
@@ -71,6 +80,7 @@ export default {
const {
data: { listContributions },
} = result
+ this.contributionCount = listContributions.length
this.items = listContributions
// this.toastSuccess(result.data)
})
@@ -78,9 +88,28 @@ export default {
this.toastError(err.message)
})
},
+ verifyLogin() {
+ this.$apollo
+ .query({
+ query: verifyLogin,
+ fetchPolicy: 'network-only',
+ })
+ .then((result) => {
+ const {
+ data: { verifyLogin },
+ } = result
+ this.$store.dispatch('login', verifyLogin)
+ })
+ .catch(() => {
+ this.$emit('logout')
+ })
+ },
},
created() {
- this.getListContributions()
+ this.updateListContributions({
+ currentPage: this.currentPage,
+ pageSize: this.pageSize,
+ })
},
}