Add watcher so changing to logged in user's team from viewing another teams page works without reload

This commit is contained in:
Peter 2023-09-17 10:17:57 -04:00
parent 4fbb1f0284
commit bd0bafe705

View File

@ -244,6 +244,16 @@ export default {
created() {
this.fetchData()
},
watch: {
seasonNumber(newValue, oldValue) {
if (newValue !== oldValue)
this.fetchData()
},
teamAbbreviation(newName, oldName) {
if (newName !== oldName)
this.fetchData()
}
},
methods: {
async fetchData(): Promise<void> {
this.team = await fetchTeam(this.seasonNumber, this.teamAbbreviation)