diff --git a/customer-vue/src/components/StoreNavigation.vue b/customer-vue/src/components/StoreNavigation.vue index c68ac1b..c8d7145 100644 --- a/customer-vue/src/components/StoreNavigation.vue +++ b/customer-vue/src/components/StoreNavigation.vue @@ -42,7 +42,6 @@ export default { props: ["store"], data: function() { return { - storeId:-1, favoriteStore:{ status:true, color:null, @@ -50,34 +49,40 @@ export default { } } }, - methods:{ + watch:{ + store (){ + // alert() + this.getFavoriteStoreByStoreId() + } + }, + methods:{ markStar:function () { - this.changeStarStatus() + this.changeStarStatus(!this.favoriteStore.status) var vm = this - storeApi.markStar(this.storeId) + storeApi.markStar(this.store.id) .then(()=>{ vm.favoriteStore.status? alert('즐겨찾는 매장에서 제외되었습니다.') : alert('즐겨찾는 매장에 등록되었습니다.') }) }, - getFavoriteStoreByStoreId: function (storeId){ + getFavoriteStoreByStoreId: function (){ var vm = this - storeApi.getFavoriteStoreByStoreId(storeId) + storeApi.getFavoriteStoreByStoreId(this.store.id) .then((response)=>{ - if(response.data.data.exist) vm.changeStarStatus() + if(response.data.data.exist) vm.changeStarStatus(response.data.data.exist) }) }, - changeStarStatus(){ + changeStarStatus(status){ - if(this.favoriteStore.status){ + if(status){ this.favoriteStore.color = "rgb(255, 152, 0)" this.favoriteStore.icon = "mdi-heart" }else{ this.favoriteStore.color = null this.favoriteStore.icon = "mdi-heart-outline" } - this.favoriteStore.status= !this.favoriteStore.status + this.favoriteStore.status= status }, logout: function () { @@ -89,9 +94,8 @@ export default { }, mounted() { - console.log(this.$route.params) - this.storeId =this.$route.params.storeId - this.getFavoriteStoreByStoreId(this.storeId) + + // this.getFavoriteStoreByStoreId(this.storeId) } } diff --git a/customer-vue/src/views/ItemDetail.vue b/customer-vue/src/views/ItemDetail.vue index 1493ab9..a92e941 100644 --- a/customer-vue/src/views/ItemDetail.vue +++ b/customer-vue/src/views/ItemDetail.vue @@ -124,17 +124,18 @@ export default { getItemData: async function (){ storeApi.fetchItem(this.itemId) .then(response=>{ - console.log(response) this.itemData = response.data.data this.setItem.itemId = this.itemData.id this.setItem.price = this.itemData.price this.storeId = this.itemData.storeId this.setItem.storeId = this.itemData.storeId + this.$emit('getStoreId', this.storeId) }) .catch(error=>{ console.log(error) this.$router.push("/") }) + }, parseGroup: function (type){ let group= []; diff --git a/store-service/src/test/java/com/justpickup/storeservice/domain/category/web/CategoryOwnerApiControllerTest.java b/store-service/src/test/java/com/justpickup/storeservice/domain/category/web/CategoryOwnerApiControllerTest.java index 3988a8c..b799c3b 100644 --- a/store-service/src/test/java/com/justpickup/storeservice/domain/category/web/CategoryOwnerApiControllerTest.java +++ b/store-service/src/test/java/com/justpickup/storeservice/domain/category/web/CategoryOwnerApiControllerTest.java @@ -27,6 +27,8 @@ import java.util.List; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; +import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; +import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; import static org.springframework.restdocs.payload.PayloadDocumentation.*; import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; import static org.springframework.restdocs.request.RequestDocumentation.requestParameters; @@ -76,14 +78,10 @@ class CategoryOwnerApiControllerTest { //then actions.andExpect(MockMvcResultMatchers.status().isOk()) - .andExpect(MockMvcResultMatchers.jsonPath("data[0].categoryId").value("10")) - .andExpect(MockMvcResultMatchers.jsonPath("data[0].name").value("카테고리1")) - .andExpect(MockMvcResultMatchers.jsonPath("data[1].categoryId").value("11")) - .andExpect(MockMvcResultMatchers.jsonPath("data[1].name").value("카테고리2")) .andDo(MockMvcResultHandlers.print()) .andDo(MockMvcRestDocumentation.document("get-categoryList", - requestParameters( - parameterWithName("storeId").description("매장 고유 번호") + requestHeaders( + headerWithName("user-id").description("로그인한 유저 id") ), responseFields( fieldWithPath("code").description("결과 코드 SUCCESS/ERROR"),