feat: add environment configuration and implement cookie handling for user authentication

This commit is contained in:
Ardeman
2025-02-27 19:37:31 +08:00
parent 9386b8dd69
commit f9d861f24d
15 changed files with 213 additions and 30 deletions
+5 -9
View File
@@ -1,11 +1,14 @@
import { Link } from 'react-router'
import { Link, useRouteLoaderData } from 'react-router'
import { Button } from '~/components/ui/button'
import { APP } from '~/configs/meta'
import { useNewsContext } from '~/contexts/news'
import type { loader } from '~/routes/_layout.news'
export const HeaderTop = () => {
const { setIsLoginOpen } = useNewsContext()
const loaderData = useRouteLoaderData<typeof loader>('routes/_layout.news')
return (
<>
<div className="flex h-[60px] items-center justify-between bg-white px-5 align-middle sm:h-[100px] sm:gap-[15px] sm:px-[50px] sm:py-[20px]">
@@ -31,15 +34,8 @@ export const HeaderTop = () => {
className="hidden sm:block"
onClick={() => setIsLoginOpen(true)}
>
Akun
{loaderData?.userToken ? 'Logout' : 'Masuk'}
</Button>
<div className="w-[50px] sm:w-[60px]">
<img
alt="language"
src="/flags/id.svg"
className="shadow-sm"
/>
</div>
</div>
</div>
</>