diff --git a/src/pages/admin/events/index.tsx b/src/pages/admin/events/index.tsx index 632b886..922d0c8 100644 --- a/src/pages/admin/events/index.tsx +++ b/src/pages/admin/events/index.tsx @@ -66,12 +66,12 @@ const renderData = (events: Event[]) => { }; const AdminEventPage: NextPage = () => { - const { data } = useSWR([APIPath.EVENTS, { auth: true }], fetcher); + const { data: events } = useSWR([APIPath.EVENTS, { auth: true }], fetcher); return (

Events

- {renderData(data)} + {renderData(events)}
); }; diff --git a/src/pages/admin/feed/index.tsx b/src/pages/admin/feed/index.tsx index a61e235..09d9d25 100644 --- a/src/pages/admin/feed/index.tsx +++ b/src/pages/admin/feed/index.tsx @@ -66,12 +66,12 @@ const renderData = (feed: Post[]) => { }; const AdminFeedPage: NextPage = () => { - const { data } = useSWR([APIPath.FEED, { auth: true }], fetcher); + const { data: feed } = useSWR([APIPath.FEED, { auth: true }], fetcher); return (

Feed

- {renderData(data)} + {renderData(feed)}
); }; diff --git a/src/pages/admin/jobads/index.tsx b/src/pages/admin/jobads/index.tsx index 67c9dfe..e5cb9f7 100644 --- a/src/pages/admin/jobads/index.tsx +++ b/src/pages/admin/jobads/index.tsx @@ -70,12 +70,12 @@ const renderData = (jobAds: JobAd[]) => { }; const AdminJobAdPage: NextPage = () => { - const { data } = useSWR([APIPath.JOBADS, { auth: true }], fetcher); + const { data: jobAds } = useSWR([APIPath.JOBADS, { auth: true }], fetcher); return (

Job advertisements

- {renderData(data)} + {renderData(jobAds)}
); }; diff --git a/src/pages/in_english.tsx b/src/pages/in_english.tsx index b60a8fc..121a9af 100644 --- a/src/pages/in_english.tsx +++ b/src/pages/in_english.tsx @@ -24,8 +24,8 @@ interface InitialProps { } const InEnglishPage: NextPage = ({ initialEvents, initialFeed }) => { - const eventResult = useSWR([APIPath.EVENTS, eventOptions], fetcher, { fallbackData: initialEvents }); - const feedResult = useSWR([APIPath.FEED, feedOptions], fetcher, { fallbackData: initialFeed }); + const { data: events } = useSWR([APIPath.EVENTS, eventOptions], fetcher, { fallbackData: initialEvents }); + const { data: feed } = useSWR([APIPath.FEED, feedOptions], fetcher, { fallbackData: initialFeed }); return ( <> @@ -33,7 +33,7 @@ const InEnglishPage: NextPage = ({ initialEvents, initialFeed }) = - + ); diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 3846a7d..6101204 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -24,8 +24,8 @@ interface InitialProps { } const FrontPage: NextPage = ({ initialEvents, initialFeed }) => { - const eventResult = useSWR([APIPath.EVENTS, eventOptions], fetcher, { fallbackData: initialEvents }); - const feedResult = useSWR([APIPath.FEED, feedOptions], fetcher, { fallbackData: initialFeed }); + const { data: events } = useSWR([APIPath.EVENTS, eventOptions], fetcher, { fallbackData: initialEvents }); + const { data: feed } = useSWR([APIPath.FEED, feedOptions], fetcher, { fallbackData: initialFeed }); return ( <> @@ -33,7 +33,7 @@ const FrontPage: NextPage = ({ initialEvents, initialFeed }) => { - + ); diff --git a/src/pages/kilta/toiminta.tsx b/src/pages/kilta/toiminta.tsx index 08cdd23..d773e26 100644 --- a/src/pages/kilta/toiminta.tsx +++ b/src/pages/kilta/toiminta.tsx @@ -16,8 +16,8 @@ interface InitialProps { } const ActualPage: NextPage = ({ initialEvents, initialFeed }) => { - const eventResult = useSWR([APIPath.EVENTS, {}], fetcher, { fallbackData: initialEvents }); - const feedResult = useSWR([APIPath.FEED, {}], fetcher, { fallbackData: initialFeed }); + const { data: events } = useSWR([APIPath.EVENTS, {}], fetcher, { fallbackData: initialEvents }); + const { data: feed } = useSWR([APIPath.FEED, {}], fetcher, { fallbackData: initialFeed }); return ( <> @@ -25,7 +25,7 @@ const ActualPage: NextPage = ({ initialEvents, initialFeed }) => { - + ); diff --git a/src/pages/signup/[id].tsx b/src/pages/signup/[id].tsx index 5134d68..8ce4f8f 100644 --- a/src/pages/signup/[id].tsx +++ b/src/pages/signup/[id].tsx @@ -24,7 +24,7 @@ const SignUpPage: NextPage = ({ initialForm }) => { const router = useRouter(); const id = String(initialForm?.id ?? ""); const URL = `${FORM_URL}${id}/`; - const { data, error } = useSWR(URL, (url) => axios.get(url).then((res) => res.data), { fallbackData: initialForm }); + const { data: signupForm, error } = useSWR(URL, (url) => axios.get(url).then((res) => res.data), { fallbackData: initialForm }); if (error) { console.error(error); @@ -35,7 +35,7 @@ const SignUpPage: NextPage = ({ initialForm }) => { return ; } - if (!data) { + if (!signupForm) { return ( ); @@ -43,7 +43,7 @@ const SignUpPage: NextPage = ({ initialForm }) => { const onSubmit = async ({ formData }: ISubmitEvent) => { const payload: Signup = { - signupForm_id: data.id, + signupForm_id: signupForm.id, answer: formData, }; @@ -60,11 +60,11 @@ const SignUpPage: NextPage = ({ initialForm }) => { return ( <> - + = ({ initialJobAds }) => { - const { data } = useSWR([APIPath.JOBADS, {}], fetcher, { fallbackData: initialJobAds }); + const { data: jobAds } = useSWR([APIPath.JOBADS, {}], fetcher, { fallbackData: initialJobAds }); return ( <> - + );