File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import SizeText from "@/components/archive-detail/SizeText";
1313import { useCreateChatRoom } from "@/hooks/useCreateChatRoom" ;
1414import { getArtworkDetail } from "@/services/artworks" ;
1515import { normalizeImageUrl } from "@/utils/normalizeImageUrl" ;
16- import { useRequireAuth } from "@/hooks/useRequireAuth " ;
16+ import { useAuthStore } from "@/stores/useAuthStore " ;
1717
1818function formatDate ( date : string | null ) {
1919 if ( ! date ) return "-" ;
@@ -33,7 +33,7 @@ export default function ArtDetailPage() {
3333 const params = useParams < { id : string } > ( ) ;
3434 const artworkId = params . id ;
3535 const createChatRoom = useCreateChatRoom ( ) ;
36- const { isAuthReady , isAuthenticated } = useRequireAuth ( "/auth" ) ;
36+ const accessToken = useAuthStore ( state => state . accessToken ) ;
3737 const [ inquiryErrorMessage , setInquiryErrorMessage ] = useState < string | null > ( null ) ;
3838
3939 const query = useQuery ( {
@@ -58,7 +58,10 @@ export default function ArtDetailPage() {
5858 const handleInquiryClick = ( ) => {
5959 if ( ! Number . isFinite ( numericArtworkId ) ) return ;
6060
61- if ( ! isAuthReady || ! isAuthenticated ) return ;
61+ if ( ! accessToken ) {
62+ router . push ( "/auth" ) ;
63+ return ;
64+ }
6265
6366 setInquiryErrorMessage ( null ) ;
6467 createChatRoom . mutate (
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import SizeText from "@/components/archive-detail/SizeText";
1212import { useCreateChatRoom } from "@/hooks/useCreateChatRoom" ;
1313import { getSpaceDetail } from "@/services/spaces" ;
1414import { normalizeImageUrl } from "@/utils/normalizeImageUrl" ;
15- import { useRequireAuth } from "@/hooks/useRequireAuth " ;
15+ import { useAuthStore } from "@/stores/useAuthStore " ;
1616
1717function hasText ( value ?: string | null ) {
1818 return Boolean ( value ?. trim ( ) ) ;
@@ -27,7 +27,7 @@ export default function SpaceDetailPage() {
2727 const params = useParams < { id : string } > ( ) ;
2828 const spaceId = params . id ;
2929 const createChatRoom = useCreateChatRoom ( ) ;
30- const { isAuthReady , isAuthenticated } = useRequireAuth ( "/auth" ) ;
30+ const accessToken = useAuthStore ( state => state . accessToken ) ;
3131 const [ inquiryErrorMessage , setInquiryErrorMessage ] = useState < string | null > ( null ) ;
3232
3333 const query = useQuery ( {
@@ -53,7 +53,10 @@ export default function SpaceDetailPage() {
5353 const handleInquiryClick = ( ) => {
5454 if ( ! Number . isFinite ( numericSpaceId ) ) return ;
5555
56- if ( ! isAuthReady || ! isAuthenticated ) return ;
56+ if ( ! accessToken ) {
57+ router . push ( "/auth" ) ;
58+ return ;
59+ }
5760
5861 setInquiryErrorMessage ( null ) ;
5962 createChatRoom . mutate (
You can’t perform that action at this time.
0 commit comments