diff --git a/src/components/CommunityComponents/NewCommunityForm.vue b/src/components/CommunityComponents/NewCommunityForm.vue index 7a62e90f302416559f695459aafcfddfd6f43244..a088cd5d4f487b4e5cf2d36d7d81c7a823be802e 100644 --- a/src/components/CommunityComponents/NewCommunityForm.vue +++ b/src/components/CommunityComponents/NewCommunityForm.vue @@ -278,12 +278,13 @@ export default { location: this.group.place, picture: this.group.image, }; - - console.log(this.group.image); - const respone = await postNewgroup(groupInfo); if (respone.status === 200 || respone.status === 201) { - this.$router.push({ path: "/", replace: true }); + this.$store.commit("addAdmin", respone.data); + this.$router.push({ + path: "/community/" + respone.data, + replace: true, + }); } } }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 8c3744e58a0c4e387ddb83cfcef1a99efebbff7d..00d6665d7964d04a606aa2959e57672be8510044 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -6,6 +6,7 @@ const state = { const mutations = { logout(state) { state.token = null; + state.adminList = []; }, saveToken(state, token) { state.token = token; @@ -18,6 +19,10 @@ const mutations = { state.adminList.push(communityIDArray[i]); } }, + addAdmin(state, communityID) { + if (!Number(communityID)) return; + state.adminList.push(communityID); + }, }; export default {