feat: ListTeams script setup
This commit is contained in:
parent
cdf359da00
commit
17b77c25c1
1 changed files with 13 additions and 22 deletions
|
@ -25,29 +25,20 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script setup lang="ts">
|
||||||
import {defineComponent} from 'vue'
|
import {ref, shallowReactive} from 'vue'
|
||||||
import TeamService from '../../services/team'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
export default defineComponent({
|
import TeamService from '@/services/team'
|
||||||
name: 'ListTeams',
|
import { useTitle } from '@/composables/useTitle'
|
||||||
data() {
|
|
||||||
return {
|
const { t } = useI18n()
|
||||||
teamService: new TeamService(),
|
useTitle(() => t('team.title'))
|
||||||
teams: [],
|
|
||||||
}
|
const teams = ref([])
|
||||||
},
|
const teamService = shallowReactive(new TeamService())
|
||||||
created() {
|
teamService.getAll().then((result) => {
|
||||||
this.loadTeams()
|
teams.value = result
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.setTitle(this.$t('team.title'))
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async loadTeams() {
|
|
||||||
this.teams = await this.teamService.getAll()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue