summaryrefslogtreecommitdiffstats
path: root/src/pages
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-01-24 14:52:04 +0100
committerArmand Philippot <git@armandphilippot.com>2022-01-24 19:12:06 +0100
commit958569e09071e4bb290f0ec120b4309ae5983d2d (patch)
treebb3e49a7b616ccf0acdef330294d7dbbb7339135 /src/pages
parent368fbbf83b913b90cef9dfbe4288e148d589d033 (diff)
refactor(project): replace repo api call method with hook and swr
Instead of using post slug and an environment variable to fetch repo data, I use the given repo in each project MDX file. It allows me to fetch data from another user/organization if needed. To make it work, I no longer provide the full URL in MDX file. The new format is: "User/repo-slug". I also replaced the fetch method with SWR to improve caching and to avoid React complaining about cleanup useEffect.
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/projet/[slug].tsx2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pages/projet/[slug].tsx b/src/pages/projet/[slug].tsx
index 82e2ea3..0f3aea9 100644
--- a/src/pages/projet/[slug].tsx
+++ b/src/pages/projet/[slug].tsx
@@ -103,7 +103,7 @@ const Project: NextPageWithLayout<ProjectProps> = ({
<ToC />
</Sidebar>
<div className={styles.body}>
- <ProjectSummary slug={id} title={title} cover={cover} meta={meta} />
+ <ProjectSummary title={title} cover={cover} meta={meta} />
<ProjectContent />
</div>
<Sidebar position="right">