Skip to content

Commit

Permalink
feat: [판매자 마이페이지] API type, 호출함수 작성 (#41)
Browse files Browse the repository at this point in the history
Co-authored-by: heejung <[email protected]>
  • Loading branch information
heejung0413 and heejung committed Nov 16, 2023
1 parent 6215dad commit d3bc908
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/api/@types/@shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export interface Coordinate {

export interface ProductSeller {
id: number;
username: string;
name: string;
phone: string;
avatarUrl: string;
profileImageUrl: string;
salesCount: number;
reviewCount: number;
}
Expand Down
22 changes: 21 additions & 1 deletion src/api/@types/My.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PageRequest, PageResponse, PurchaserGetAccountInfo } from '@/api/@types/@shared';
import { SellerDetails } from './Auth';
import { Coordinate, PageRequest, PageResponse, PurchaserGetAccountInfo } from '@/api/@types/@shared';
import { ProductSummary } from '@/api/@types/Products';

export interface PurchaserSubscribeRequest {
Expand All @@ -9,9 +10,28 @@ export interface PurchaserUnsubscribeRequest {
id: number;
}

export interface SellerGetAccountInfo extends SellerDetails {
location: string;
bankName: string;
account: string;
}

export interface sellerBankInfo {
bankName: string;
account: string;
}

export interface SellerFixedLocationInfoRequest extends Coordinate {
location: string;
}

export interface MyClient {
purchaserGetAccountInfo(): Promise<PurchaserGetAccountInfo>;
purchaserSubscribe(request: PurchaserSubscribeRequest): Promise<void>;
purchaserGetSubscribedProducts(request: PageRequest): Promise<PageResponse<ProductSummary>>;
purchaserUnsubscribe(request: PurchaserUnsubscribeRequest): Promise<void>;
sellerGetAccountInfo(): Promise<SellerGetAccountInfo>;
sellerFixedBankInfo(request: sellerBankInfo): Promise<void>;
sellerGetBankInfo(): Promise<sellerBankInfo>;
sellerFixedLocationInfo(request: SellerFixedLocationInfoRequest): Promise<void>;
}
14 changes: 14 additions & 0 deletions src/api/services/My.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,18 @@ export const MyService: MyClient = {
params: request,
});
},
sellerGetAccountInfo: async () => {
return await axiosInstance.get(`${ROUTE}/seller`);
},
sellerFixedBankInfo: async request => {
return await axiosInstance.patch(`${ROUTE}/seller/bank`, {
params: request,
});
},
sellerGetBankInfo: async () => {
return await axiosInstance.patch(`${ROUTE}/seller/bank-detail`);
},
sellerFixedLocationInfo: async request => {
return await axiosInstance.patch(`${ROUTE}/seller/location`, request);
},
};
6 changes: 3 additions & 3 deletions src/pages/products/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ const ProductDetailPage = () => {
<Flex>
<Avatar
size="xl"
name={product.seller.username}
src={product.seller?.avatarUrl ?? 'https://bit.ly/broken-link'}
name={product.seller.name}
src={product.seller?.profileImageUrl ?? 'https://bit.ly/broken-link'}
/>
<Box ml="3" w="100%">
<Badge fontSize="xl" colorScheme="green">
판매자
</Badge>
<Text fontSize="xl" fontWeight="bold">
{product.seller.username}
{product.seller.name}
<Text fontSize="xl" color="gray">
판매 재고 {product.seller.salesCount} 후기 {product.seller.reviewCount}
</Text>
Expand Down

0 comments on commit d3bc908

Please sign in to comment.