Skip to content

Commit

Permalink
[ADD] FE แสดง Subscribe Community ของผู้ใช้คนนั้นๆ
Browse files Browse the repository at this point in the history
  • Loading branch information
wdrdres3qew5ts21 committed Nov 10, 2019
1 parent e5d170a commit b3131c8
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions nuxt-firebase-auth-master/pages/community/subscribeCommunity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
<div>
<br />
<h2>Subscribed Community</h2>
<community-card
v-for="(community, index) in communityList"
:key="index"
:communityPictureCover="community.communityDetail.communityPictureCover"
:communityName="community.communityDetail.communityName"
></community-card>
<div v-for="(community, index) in communityList" :key="index">
<nuxt-link :to="`/community/${community.communityDetail[0].communityId}`">
<community-card
:communityPictureCover="community.communityDetail[0].communityPictureCover"
:communityName="community.communityDetail[0].communityName"
></community-card>
</nuxt-link>
</div>
</div>
</template>
<script>
import axios from "axios";
import { mapGetters } from "vuex";
import CommunityCard from "@/components/communityCard";
import {
mockCarouselsPhoto,
Expand All @@ -21,25 +24,37 @@ import {
export default {
data() {
return {
communityList: []
communityList: [
{
communityDetail: [
{
communityPictureCover: "",
communityName: ""
}
]
}
]
};
},
components: {
CommunityCard
},
computed: {
...mapGetters(["getUser"])
},
mounted() {
this.communityList = mockCommunityList;
// this.communityList = mockCommunityList;
this.loadUserSubscribeCommunity();
},
methods: {
loadUserSubscribeCommunity() {
let loader = this.$loading.show();
axios
.get(
`${process.env.COMMUNITY_SERVICE}/community/${this.communityId}/subscribe/status`
`${process.env.COMMUNITY_SERVICE}/communitys/user/${this.getUser.uid}`
)
.then(subscribeCommunityResponse => {
this.communityList = subscribeCommunityResponse.data
this.communityList = subscribeCommunityResponse.data;
loader.hide();
})
.catch(err => {
Expand Down

0 comments on commit b3131c8

Please sign in to comment.