feat: ListTeams script setup

This commit is contained in:
Dominik Pschenitschni 2022-05-21 02:15:18 +02:00 committed by Gitea
parent cdf359da00
commit 17b77c25c1

View file

@ -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>