Skip to content

Commit

Permalink
fix: change to useCurrentPerson hook
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorazhelyazkova committed Jul 9, 2024
1 parent 893ef96 commit f3bff0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback, useMemo, useState } from 'react'
import { useCallback, useState } from 'react'
import { Grid, StepLabel } from '@mui/material'
import { PersonResponse } from 'gql/person'
import { Person } from 'gql/person'

import {
CampaignApplicationFormData,
Expand Down Expand Up @@ -41,7 +41,7 @@ const steps: StepType[] = [
]

type Props = {
person: PersonResponse
person?: Person
}

export default function CampaignApplicationForm({ person }: Props) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { CircularProgress, Grid } from '@mui/material'
import { useSession } from 'next-auth/react'
import { useViewPersonByKeylockId } from 'common/hooks/person'
import { useCurrentPerson } from 'common/util/useCurrentPerson'
import Layout from '../layout/Layout'
import CampaignApplicationForm from './CampaignApplicationForm'

export default function CampaignApplicationPage() {
const { data: session } = useSession()
const { data: person, isLoading } = useViewPersonByKeylockId(session?.user?.sub as string)
const { data: userData, isLoading } = useCurrentPerson()
const person = userData?.user || undefined

if (isLoading) {
return (
Expand All @@ -18,7 +17,7 @@ export default function CampaignApplicationPage() {

return (
<Layout maxWidth="md" sx={{ paddingInline: 5 }}>
{person && <CampaignApplicationForm person={person} />}
<CampaignApplicationForm person={person} />
</Layout>
)
}

0 comments on commit f3bff0f

Please sign in to comment.