forked from kompetenzinventar/ki-frontend
Merge pull request 'fix profile display' (#49) from fix/48-profile into main
Reviewed-on: kompetenzinventar/ki-frontend#49
This commit is contained in:
commit
2b63603957
@ -54,17 +54,20 @@ export default {
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
onError({commit}) {
|
||||
onError({commit, dispatch}) {
|
||||
commit('setError')
|
||||
commit('clearProfileId')
|
||||
commit('clearProfile')
|
||||
commit('setNotLoading')
|
||||
commit('hideSpinner')
|
||||
dispatch('clear')
|
||||
},
|
||||
onNotFound({commit, dispatch}) {
|
||||
dispatch('onError')
|
||||
commit('setNotFound', true)
|
||||
},
|
||||
clear({commit}) {
|
||||
commit('clearProfileId')
|
||||
commit('clearProfile')
|
||||
commit('hideSpinner')
|
||||
commit('setNotLoading')
|
||||
},
|
||||
async load({state, commit, dispatch, rootState}, profileId) {
|
||||
if (state.loading) {
|
||||
return
|
||||
@ -111,7 +114,7 @@ export default {
|
||||
const responseData = await response.json()
|
||||
commit('setProfile', responseData.profile)
|
||||
commit('hideSpinner')
|
||||
commit('setNotSearching')
|
||||
commit('setNotLoading')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,8 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
load: 'profile/load'
|
||||
loadProfile: 'profile/load',
|
||||
clearStore: 'profile/clear',
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
@ -126,8 +127,11 @@ export default {
|
||||
},
|
||||
async created() {
|
||||
const id = parseInt(this.$route.params.memberId, 10)
|
||||
this.load(id)
|
||||
}
|
||||
this.loadProfile(id)
|
||||
},
|
||||
unmounted() {
|
||||
this.clearStore()
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user