fix: add types

This commit is contained in:
Rekhtina Anastasia 2025-05-18 01:14:06 +07:00
parent ca796b03f5
commit f5fb8f6a1a

View File

@ -1,9 +1,25 @@
<script setup lang="ts">
import { ref } from 'vue';
// Типы лучше вынести в отдельный файлик, конечно
// я их для наглядности оставил
type Application = {
name: string
}
type Action = {
id: string
place: string;
text: string
applications: Application[]
}
type Team = {
actions: Action[]
}
const place = ref("")
// Здесь тип поправь если че
const team = ref()
const team = ref<Team | null>(null)
function getTeam() {
fetch("http://localhost:8090/team", {
@ -13,8 +29,8 @@ import { ref } from 'vue';
"X-Password": "pass"
},
})
.then((response) => {
team.value = response.json()
.then(async (response) => {
team.value = await response.json()
})
.then((json) => console.log(json));
}
@ -28,11 +44,11 @@ import { ref } from 'vue';
</script>
<template>
<div v-if="!team.actions.length">
<div v-if="!team">
Пора решать загадку
</div>
<template v-else>
<div v-for="action in team.actions" :key="action">
<div v-for="action in team.actions" :key="action.id">
<p>{{ action.text }}</p>
</div>
</template>