Call apollo query to get the countPendingCreations value. added an update to the store of this value, call it when overview is created.

This commit is contained in:
ogerly 2021-11-26 11:00:58 +01:00
parent 9e45a21687
commit 296d916f1a
3 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,7 @@
import gql from 'graphql-tag'
export const countPendingCreations = gql`
query {
countPendingCreations
}
`

View File

@ -76,7 +76,24 @@
</div> </div>
</template> </template>
<script> <script>
import { countPendingCreations } from '../graphql/getCountPendingCreations'
export default { export default {
name: 'overview', name: 'overview',
methods: {
getCountPendingCreation() {
this.$apollo
.query({
query: countPendingCreations,
})
.then((result) => {
this.$store.commit('setOpenCreations', result.data.countPendingCreations)
})
.catch()
},
},
created() {
this.getCountPendingCreation()
},
} }
</script> </script>

View File

@ -18,6 +18,9 @@ export const mutations = {
token: (state, token) => { token: (state, token) => {
state.token = token state.token = token
}, },
setOpenCreations: (state, openCreations) => {
state.openCreations = openCreations
},
} }
export const actions = { export const actions = {