39 lines
1006 B
TypeScript
39 lines
1006 B
TypeScript
import React from "react";
|
|
import { NextPage, GetServerSideProps } from "next";
|
|
import Head from "next/head";
|
|
import useSWR from "swr";
|
|
import { JobAd, getJobAds } from "@models/JobAd";
|
|
import CorporatePageView from "@views/CorporatePage/CorporatePageView";
|
|
import PageWrapper from "@views/common/PageWrapper";
|
|
|
|
const jobAdFetcher = () => getJobAds();
|
|
|
|
interface InitialProps {
|
|
initialJobAds: JobAd[];
|
|
}
|
|
|
|
const CorporatePage: NextPage<InitialProps> = ({ initialJobAds }) => {
|
|
const { data, error } = useSWR("allJobAds", jobAdFetcher, { initialData: initialJobAds })
|
|
return (
|
|
<>
|
|
<Head>
|
|
<link rel="canonical" href="https://sik.ayy.fi/yritysyhteistyo" />
|
|
</Head>
|
|
<PageWrapper>
|
|
<CorporatePageView jobAds={data} />
|
|
</PageWrapper>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export const getServerSideProps: GetServerSideProps<InitialProps> = async () => {
|
|
const initialJobAds = await jobAdFetcher();
|
|
return {
|
|
props: {
|
|
initialJobAds
|
|
}
|
|
}
|
|
}
|
|
|
|
export default CorporatePage;
|