From 07819844d5ef7e323fd956eacfedecb2f4f4bb80 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Fri, 17 Nov 2023 15:16:23 +0700
Subject: Update result feature

---
 src/common/components/Authenticated/index.tsx | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

(limited to 'src/common/components/Authenticated/index.tsx')

diff --git a/src/common/components/Authenticated/index.tsx b/src/common/components/Authenticated/index.tsx
index cf7086e..3957a8d 100644
--- a/src/common/components/Authenticated/index.tsx
+++ b/src/common/components/Authenticated/index.tsx
@@ -1,10 +1,9 @@
-import { cookies } from 'next/headers'
+import getServerCredential from '@/common/libs/getServerCredential'
 import { redirect } from 'next/navigation'
 import React from 'react'
 
 const Authenticated = ({ children }: { children: React.ReactNode }) => {
-  const credentialStr = cookies().get('credential')?.value
-  const credential: Credential | null = credentialStr ? JSON.parse(credentialStr) : null
+  const credential = getServerCredential()
 
   if (!credential) redirect('/login')
 
-- 
cgit v1.2.3

