Skip to content

Commit

Permalink
fixed some typescript bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
yoursAniki committed Feb 27, 2024
1 parent 7c44140 commit 938a77a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import axios from "axios";
import autoAnimate from "@formkit/auto-animate";
import type { MyData } from "~/types/types";
interface CityResponse {
name: string;
Expand Down Expand Up @@ -60,7 +61,7 @@ let error: string = "";
const refError = ref(error);
// Добавление карточки с погодой
const addCity = () => {
const addCity = (): void => {
if (city.message.trim().length < 2) {
refError.value = "You need to enter a name with a length of more than 1.";
return;
Expand Down Expand Up @@ -147,23 +148,21 @@ onMounted(() => {
autoAnimate(animation.value);
});
// Обновление индексов
const updateIndexNum = () => {
refWeatherCards.value.forEach((card, index) => {
card.id = index;
});
};
// Удаление всех карточек
const deleteAllCards = () => {
const deleteAllCards = (): void => {
refWeatherCards.value.splice(0, refWeatherCards.value.length);
id = 0;
};
// Удаление конкретной карточки
const deleteCard = cardId => {
console.log(cardId);
// refWeatherCards.value.splice(cardId, 1);
// id--;
const deleteCard = (cardId: number): void => {
if (cardId !== -1) {
refWeatherCards.value.splice(cardId, 1);
id--;
Expand Down

0 comments on commit 938a77a

Please sign in to comment.