-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[USER] 마이페이지 구현
- Loading branch information
Showing
37 changed files
with
1,261 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { User } from 'api/user/entity'; | ||
|
||
export interface Shop { | ||
shopId: number, | ||
placeId: string, | ||
name: string, | ||
category: string, | ||
} | ||
|
||
export interface ReviewedShopsResponse { | ||
content: Shop[], | ||
totalPages: number, | ||
totalElements: number | ||
} | ||
|
||
export interface Review { | ||
id: number, | ||
content: string, | ||
rate: number, | ||
createdAt: string | ||
} | ||
|
||
export interface ReviewsResponse { | ||
content: Review[] | ||
} | ||
|
||
export type Scrap = { | ||
placeId: string, | ||
category: string, | ||
name: string, | ||
photo: string, | ||
ratingCount: number, | ||
scrapId: number, | ||
totalRating: number | ||
}; | ||
export interface ScrapResponse { | ||
content: Scrap[], | ||
totalPages: number, | ||
totalElements: number | ||
} | ||
|
||
export interface PatchProfileImageResponse { | ||
profileImage: { | ||
id: number, | ||
originalName: string, | ||
path: string, | ||
url: string | ||
} | ||
} | ||
|
||
export interface PatchNicknameResponse { | ||
nickname: string | ||
} | ||
|
||
export interface FollowersResponse { | ||
content: User[], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import followApi from 'api/follow/followApiClient'; | ||
import { | ||
FollowersResponse, | ||
PatchNicknameResponse, | ||
PatchProfileImageResponse, ReviewedShopsResponse, ReviewsResponse, ScrapResponse, | ||
} from './entity'; | ||
import myPageApi from './mypageApiClient'; | ||
|
||
export const getReviewedShops = async () => myPageApi.get<ReviewedShopsResponse>('/review/shops'); | ||
|
||
export const getReviews = async (placeId:string) => myPageApi.get<ReviewsResponse>(`/review/shop/${placeId}`); | ||
|
||
export const getScraps = async (pageParam:number) => myPageApi.get<ScrapResponse>(`/scraps?cursor=${pageParam}`); | ||
|
||
export const patchProfileImage = async (image:FormData | null) => myPageApi.patch<PatchProfileImageResponse>('/user/profile', image, { | ||
headers: { | ||
'Content-Type': 'multipart/form-data', | ||
}, | ||
}); | ||
|
||
export const patchDefaultImage = async () => myPageApi.patch<PatchProfileImageResponse>('/user/profile', { | ||
headers: { | ||
'Content-Type': 'multipart/form-data', | ||
}, | ||
}); | ||
|
||
export const patchNickname = async (nickname:string) => myPageApi.patch<PatchNicknameResponse>('/user/me', { nickname }); | ||
|
||
export const getFollwers = async () => followApi.get<FollowersResponse>('/follow/followers'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { API_PATH } from 'config/constants'; | ||
import axios from 'axios'; | ||
|
||
const myPageApi = axios.create({ | ||
baseURL: `${API_PATH}`, | ||
timeout: 2000, | ||
}); | ||
|
||
myPageApi.interceptors.request.use( | ||
(config) => { | ||
const accessToken = sessionStorage.getItem('accessToken'); | ||
// eslint-disable-next-line no-param-reassign | ||
if (config.headers && accessToken) config.headers.Authorization = `Bearer ${accessToken}`; | ||
return config; | ||
}, | ||
); | ||
|
||
export default myPageApi; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.