feat: refactor subscription handling in registration form and header component
This commit is contained in:
parent
4aa6c8d0d4
commit
9980cb90df
@ -31,6 +31,7 @@ export const FormRegister = () => {
|
||||
const [disabled, setDisabled] = useState(false)
|
||||
const fetcher = useFetcher()
|
||||
const loaderData = useRouteLoaderData<typeof loader>('routes/_layout')
|
||||
const subscriptions = loaderData?.subscriptionsData
|
||||
|
||||
const formMethods = useRemixForm<TRegisterSchema>({
|
||||
mode: 'onSubmit',
|
||||
@ -98,7 +99,7 @@ export const FormRegister = () => {
|
||||
name="subscribe_plan"
|
||||
label="Subscription"
|
||||
placeholder="Pilih Subscription"
|
||||
options={loaderData?.subscriptionsData}
|
||||
options={subscriptions}
|
||||
/>
|
||||
|
||||
{error && (
|
||||
|
||||
@ -3,11 +3,12 @@ import { Link, useFetcher, 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'
|
||||
import { loader } from '~/routes/_layout'
|
||||
|
||||
export const HeaderTop = () => {
|
||||
const { setIsLoginOpen } = useNewsContext()
|
||||
const loaderData = useRouteLoaderData<typeof loader>('routes/_layout')
|
||||
const userToken = loaderData?.userToken
|
||||
const fetcher = useFetcher()
|
||||
|
||||
return (
|
||||
@ -29,7 +30,7 @@ export const HeaderTop = () => {
|
||||
<Button className="h-8 w-auto rounded-none px-3 text-xs sm:h-[50px] sm:w-[150px] sm:text-lg">
|
||||
About Us
|
||||
</Button>
|
||||
{loaderData?.userToken ? (
|
||||
{userToken ? (
|
||||
<fetcher.Form
|
||||
method="POST"
|
||||
action="/actions/logout"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user