Use SSR
This commit is contained in:
parent
59da7d5c34
commit
c8d0d1e959
@ -23,6 +23,8 @@ services:
|
|||||||
- "traefik.http.routers.website-dev-secure.tls.certresolver=le"
|
- "traefik.http.routers.website-dev-secure.tls.certresolver=le"
|
||||||
- "traefik.http.routers.website-dev-secure.service=website-dev"
|
- "traefik.http.routers.website-dev-secure.service=website-dev"
|
||||||
- "traefik.http.services.website-dev.loadbalancer.server.port=3000"
|
- "traefik.http.services.website-dev.loadbalancer.server.port=3000"
|
||||||
|
environment:
|
||||||
|
- BASE_URL=https://dev.c0ntroller.de
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
traefik:
|
traefik:
|
||||||
|
@ -23,6 +23,8 @@ services:
|
|||||||
- "traefik.http.routers.website-stable-secure.tls.certresolver=le"
|
- "traefik.http.routers.website-stable-secure.tls.certresolver=le"
|
||||||
- "traefik.http.routers.website-stable-secure.service=website-stable"
|
- "traefik.http.routers.website-stable-secure.service=website-stable"
|
||||||
- "traefik.http.services.website-stable.loadbalancer.server.port=3000"
|
- "traefik.http.services.website-stable.loadbalancer.server.port=3000"
|
||||||
|
environment:
|
||||||
|
- BASE_URL=https://c0ntroller.de
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
traefik:
|
traefik:
|
||||||
|
@ -7,13 +7,13 @@ import ProjectCard from "../components/Blog/Card";
|
|||||||
import Spinner from "../components/Spinner";
|
import Spinner from "../components/Spinner";
|
||||||
import styles from "../styles/Blog/Front.module.scss";
|
import styles from "../styles/Blog/Front.module.scss";
|
||||||
|
|
||||||
const Blog: NextPage<{}> = () => {
|
const Blog: NextPage<{ content: ContentList }> = ({content}) => {
|
||||||
const { data: projectList, error } = useSWR("/content/list.json", (...args) => fetch(...args).then(res => res.json()));
|
//const { data: projectList, error } = useSWR("/content/list.json", (...args) => fetch(...args).then(res => res.json()));
|
||||||
|
|
||||||
const generateCards = (type: string) => {
|
const generateCards = (type: string) => {
|
||||||
if (error) return <div>Error on fetching projects.</div>;
|
//if (error) return <div>Error on fetching projects.</div>;
|
||||||
if (!projectList) return <Spinner size={200} color={"#fff"} />;
|
//if (!projectList) return <Spinner size={200} color={"#ff0000"} />;
|
||||||
else return <div className={styles.contentList}>{(projectList as ContentList).filter(p => p.type === type).map(p => <ProjectCard key={p.name} title={p.title} description={p.desc.join(" ")} />)}</div>;
|
/*else*/ return <div className={styles.contentList}>{content.filter(p => p.type === type).map(p => <ProjectCard key={p.name} title={p.title} description={p.desc.join(" ")} />)}</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
@ -37,4 +37,12 @@ const Blog: NextPage<{}> = () => {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export async function getServerSideProps() {
|
||||||
|
const url = process.env.BASE_URL || "https://c0ntroller.de";
|
||||||
|
const res = await fetch(`${url}/content/list.json`);
|
||||||
|
const content = await res.json();
|
||||||
|
|
||||||
|
return { props: { content } };
|
||||||
|
}
|
||||||
|
|
||||||
export default Blog;
|
export default Blog;
|
Loading…
Reference in New Issue
Block a user