From cc973b4ead138b740489b54fdd82c11010ece9eb Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Tue, 5 Apr 2022 18:43:04 +0200 Subject: [PATCH] Spread parameter on setter --- src/components/Calendar.tsx | 6 +++++- src/components/DVB.tsx | 2 +- src/components/News.tsx | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/Calendar.tsx b/src/components/Calendar.tsx index f841c00..7342c00 100644 --- a/src/components/Calendar.tsx +++ b/src/components/Calendar.tsx @@ -12,6 +12,9 @@ function daysDifference(date1: Date, date2: Date) { date2 = date1; date1 = tmp; } + console.log("Diff") + console.log(date1) + console.log(date2) return Math.ceil((date2.getTime() - date1.getTime()) / 1000 / 60 / 60 / 24); } @@ -83,6 +86,7 @@ const Calendar = ({ secrets }: { secrets: SecretsCalendar }) => { const timeMin = new Date(); timeMin.setHours(timeMin.getHours() - 1); + console.log(timeMin); const params = new URLSearchParams({ orderBy: "startTime", fields: "items(creator,start,summary)", @@ -96,7 +100,7 @@ const Calendar = ({ secrets }: { secrets: SecretsCalendar }) => { headers: { Authorization: `Bearer ${correctToken}` } }); const events = await response.json(); - setEvents(processEventData(events.items)); + setEvents([...processEventData(events.items)]); } React.useEffect(() => { diff --git a/src/components/DVB.tsx b/src/components/DVB.tsx index 5704190..ff76375 100644 --- a/src/components/DVB.tsx +++ b/src/components/DVB.tsx @@ -29,7 +29,7 @@ const DVB = ({ stopId }: { stopId: number }) => { ); }); - setDeparturesTable(depTable); + setDeparturesTable([...depTable]); } const pullDepartures = async () => { diff --git a/src/components/News.tsx b/src/components/News.tsx index b65f579..989b39f 100644 --- a/src/components/News.tsx +++ b/src/components/News.tsx @@ -36,7 +36,7 @@ const News = () => { ) }) - setNews(newsTable); + setNews([...newsTable]); } const pullNews = async () => {