Skip to content

Commit 1b6efe6

Browse files
committed
Fetch the developer on repository change
1 parent 7cb517d commit 1b6efe6

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/components/RepositoryCard.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ export default {
6161
developer: {}
6262
};
6363
},
64-
created() {
65-
this.getDeveloper();
66-
},
6764
filters: {
6865
parseEmoji(text) {
6966
if (!text) {
@@ -72,14 +69,19 @@ export default {
7269
return emoji.emojify(text);
7370
}
7471
},
72+
watch: {
73+
repository: {
74+
async handler() {
75+
const username = this.repository.name.split("/")[0];
76+
this.developer = await this.getDeveloperByUsername(username);
77+
},
78+
immediate: true
79+
}
80+
},
7581
methods: {
7682
...mapActions({
7783
getDeveloperByUsername: "Developers/getDeveloperByUsername"
78-
}),
79-
async getDeveloper() {
80-
const username = this.repository.name.split("/")[0];
81-
this.developer = await this.getDeveloperByUsername(username);
82-
}
84+
})
8385
}
8486
};
8587
</script>

0 commit comments

Comments
 (0)