-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: user 모킹 데이터 추가 * feat: 사용자 검색 모킹 API 추가 * style: 피드 검색 API Query 수정 API Specification 문서에 나온대로 검색어에 대한 쿼리 변수명을 query -> target으로 변경 * feat: Feed 모킹 데이터와 User 모킹 데이터 연결
- Loading branch information
Showing
4 changed files
with
72 additions
and
15 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './feed'; | ||
export * from './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,28 @@ | ||
export interface IUser { | ||
id: number; | ||
profileImage: string; | ||
username: string; | ||
} | ||
|
||
function generateRandomUsername(id: number) { | ||
const prefixes = ['user', 'player', 'guest', 'member', 'star']; | ||
return prefixes[Math.floor(Math.random() * prefixes.length)] + id; | ||
} | ||
|
||
function generateUserMockData(count: number) { | ||
const mockUsers: IUser[] = []; | ||
|
||
for (let id = 1; id <= count; id++) { | ||
const user = { | ||
id, | ||
profileImage: `https://randomuser.me/api/portraits/${Math.random() > 0.5 ? 'men' : 'women'}/${id - 1}.jpg`, | ||
username: generateRandomUsername(id), | ||
}; | ||
|
||
mockUsers.push(user); | ||
} | ||
|
||
return mockUsers; | ||
} | ||
|
||
export const userMockData = generateUserMockData(100); |
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