generated from VLADIMIR/template_frontend
add async await
This commit is contained in:
@@ -15,12 +15,9 @@ const game = ref<Game | undefined>()
|
||||
const teams = ref<Teams>({ teams: [] })
|
||||
|
||||
const teamName = ref("")
|
||||
function addTeam() {
|
||||
apiAddTeam(teamName)
|
||||
}
|
||||
|
||||
function getGame() {
|
||||
apiGetGame(game, gameState)
|
||||
async function addTeam() {
|
||||
await apiAddTeam(teamName.value)
|
||||
teamName.value = ""
|
||||
}
|
||||
|
||||
function startGame() {
|
||||
@@ -32,12 +29,12 @@ function stopGame() {
|
||||
}
|
||||
|
||||
let intervalId = 0
|
||||
onMounted(() => {
|
||||
apiGetTeams(teams)
|
||||
onMounted(async () => {
|
||||
teams.value = await apiGetTeams()
|
||||
|
||||
intervalId = setInterval(() => {
|
||||
apiGetTeams(teams)
|
||||
getGame()
|
||||
intervalId = setInterval(async () => {
|
||||
teams.value = await apiGetTeams()
|
||||
apiGetGame(game, gameState)
|
||||
}, 2000);
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
|
||||
Reference in New Issue
Block a user