onsitesurvey/src/hooks/useUserType.ts

25 lines
727 B
TypeScript

import { useSessionStore } from '@/store/session'
import { useEffect, useState } from 'react'
export type UserType = 'hwj' | 'order' | 'musubi' | 'musubi_con' | 'partner'
// 로그인 된 회원 유형에 따라 조사 매물 목록 변경됨
export function useUserType() {
const { session } = useSessionStore()
const [userType, setUserType] = useState<UserType | null>(null)
const [store, setStore] = useState<string | null>(null)
const [construction_point, setConstructionPoint] = useState<string | null>(null)
// TODO: 회원 유형 설정
useEffect(() => {
if (!session?.isLoggedIn) return
setUserType('musubi_con')
}, [session])
return {
userType,
store,
construction_point,
}
}