Skip to content

Commit

Permalink
Merge pull request #187 from TEAM-FLASH/Feat/#184
Browse files Browse the repository at this point in the history
[S4] StudioItem, StudioDetail 타입 수정
  • Loading branch information
JWJung-99 authored Dec 27, 2024
2 parents 4e6b670 + 2e10880 commit 8e76d2e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/hooks/useGetStudioDetail.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useQuery } from '@tanstack/react-query';
import { IStudioItem } from 'types/types';
import { IStudioDetail } from 'types/types';

const fetchStudioDetail = async (studioId: string): Promise<IStudioItem> => {
const fetchStudioDetail = async (studioId: string): Promise<IStudioDetail> => {
const response = await fetch(`${import.meta.env.VITE_TOUCHEESE_API}/studio/detail/${studioId}`, {
method: 'GET',
headers: {
Expand All @@ -16,7 +16,7 @@ const fetchStudioDetail = async (studioId: string): Promise<IStudioItem> => {
};

export const useGetStudioDetail = (studioId: string) => {
return useQuery<IStudioItem | undefined>({
return useQuery<IStudioDetail | undefined>({
queryKey: ['studioDetail', studioId],
queryFn: () => fetchStudioDetail(studioId),
staleTime: 1000 * 60 * 60 * 2,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Studio/StudioMain/StudioMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Button from '@components/Button/Button';
import Header from '@components/Header/Header';
import KakaoMap from '@components/Kakao/KakaoMap';
import StudioNavigator from '@components/Navigator/StudioNavigator';
import Share from '@components/Share/Share';
import ShareButton from '@components/Share/ShareButton';
import { css } from '@emotion/react';
import styled from '@emotion/styled';
import { useGetStudioDetail } from '@hooks/useGetStudioDetail';
Expand Down Expand Up @@ -81,7 +81,7 @@ const StudioMain = () => {
</div>
</div>
<div css={SocialActionsStyle}>
<Share title={data.name} description={data.description} imageUrl={data.portfolios[0].url} webUrl={window.location.href} />
<ShareButton title={data.name} description={data.description} imageUrl={data.portfolios[0].url} webUrl={window.location.href} />
<Bookmark id={+!_id} count={data.bookmark_count} isBookmarked={false} />
</div>
</div>
Expand Down
30 changes: 23 additions & 7 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,41 @@ export interface IHolidays {
weekOfMonth: number;
}

export interface IStudioItem {
interface IStudioInfo {
id: number;
vibe: string;
address: string;
addressSi: string;
addressGu: string;
name: string;
description: string;
address: string;
phone: string;
view_count: number;
rating: number;
bookmark_count: number;
review_count: number;
latitude: null | string;
longitude: null | string;
openingHours: IOpeningHours[];
latitude: null | number;
longitude: null | number;
subVibe: string;
portfolios: IPortfolio[];
options: [];
holydays: IHolidays[];
}

export interface IStudioItem extends IStudioInfo {
options: IOptions[];
open_time: string;
close_time: string;
menus: IMenus[];
created_at: string;
updated_at: string;
day_of_week: string;
bookmark: boolean;
}

export interface IStudioDetail extends IStudioInfo {
options: ('CHANGING_ROOM' | 'DRESSING_ROOM' | 'HAIR_MAKEUP' | 'INDIVIDUAL_EDITING' | 'SUIT_RENTAL_FREE' | 'ORIGINAL_FILES' | 'PARKING_AREA')[];
openingHours: IOpeningHours[];
holidays: IHolidays[];
open: false;
}

export interface IStudioRes<T> {
Expand Down

0 comments on commit 8e76d2e

Please sign in to comment.