commit b45f2b094dbd1e2fa8dd30cb3ee7d6b4d24c9f7c
parent b6e43180cd82ba656e2ad0bd0a31151c9f04d06e
Author: Yongbin Kim <iam@yongbin.kim>
Date: Thu, 26 Jan 2023 11:17:11 +0900
fix(wiki): wiki view 페이지 인증할 때 로그인 토큰 안 들어가던 문제 수정
Signed-off-by: Yongbin Kim <iam@yongbin.kim>
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pages/wiki/[slug]/[...path].tsx b/pages/wiki/[slug]/[...path].tsx
@@ -1,5 +1,6 @@
import WikiArticle from '@/components/wiki/WikiArticle'
import { withConnection } from '@/lib/model_helpers'
+import { authenticationFromCookies } from '@/lib/security/token'
import { getWikiPage } from '@/pages/api/wiki/[slug]/[...path]'
import { GetServerSideProps } from 'next'
@@ -17,8 +18,10 @@ export const getServerSideProps: GetServerSideProps<WikiViewPageProps> = async (
const path = paths.join('/')
+ const token = await authenticationFromCookies(context.req.cookies)
+
const wikiPage = await withConnection(async (conn) => {
- return await getWikiPage(conn, null, slug, path)
+ return await getWikiPage(conn, token, slug, path)
})
if (wikiPage == null) {
return { notFound: true }