-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
1,104 additions
and
81 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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.
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,7 @@ | ||
import axiosInstance from '@/lib/axios/axiosInstance'; | ||
|
||
const createFollowUser = async (userId: number) => { | ||
return await axiosInstance.post(`/follow/${userId}`); | ||
}; | ||
|
||
export default createFollowUser; |
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,7 @@ | ||
import axiosInstance from '@/lib/axios/axiosInstance'; | ||
|
||
const deleteFollowUser = async (userId: number) => { | ||
return await axiosInstance.delete(`/follow/${userId}`); | ||
}; | ||
|
||
export default deleteFollowUser; |
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
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,9 @@ | ||
import axiosInstance from '@/lib/axios/axiosInstance'; | ||
|
||
const checkNicknameDuplication = async (nickname: string) => { | ||
const result = await axiosInstance.get<boolean>(`/users/exists?nickname=${nickname}`); | ||
|
||
return result.data; //true:중복 false:미중복 | ||
}; | ||
|
||
export default checkNicknameDuplication; |
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,8 +1,10 @@ | ||
import axiosInstance from '@/lib/axios/axiosInstance'; | ||
import { UserType } from '@/lib/types/userProfileType'; | ||
|
||
export const getUserOne = async (userId: number) => { | ||
const getUserOne = async (userId: number) => { | ||
const response = await axiosInstance.get<UserType>(`/users/${userId}`); | ||
|
||
return response.data; | ||
}; | ||
|
||
export default getUserOne; |
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,58 @@ | ||
import axiosInstance from '@/lib/axios/axiosInstance'; | ||
import axios from 'axios'; | ||
import { UserProfileEditType } from '@/lib/types/userProfileType'; | ||
import compressFile from '@/lib/utils/compressFile'; | ||
|
||
//프로필수정 이미지업로드 타입 | ||
interface UserPresignedUrlsType { | ||
ownerId: number; | ||
backgroundPresignedUrl: string; | ||
profilePresignedUrl: string; | ||
} | ||
|
||
interface UpdateProfileParams { | ||
userId: number; | ||
data: UserProfileEditType; | ||
} | ||
|
||
const updateProfile = async ({ userId, data }: UpdateProfileParams) => { | ||
const { nickname, description, backgroundImageUrl, profileImageUrl, newBackgroundFileList, newProfileFileList } = | ||
data; | ||
|
||
//프로필 수정 | ||
const result = await axiosInstance.patch(`/users/${userId}`, { | ||
nickname, | ||
description, | ||
backgroundImageUrl, | ||
profileImageUrl, | ||
}); | ||
|
||
//이미지 수정 없는 경우 return | ||
if (result.status !== 204 || (newBackgroundFileList === null && newProfileFileList === null)) return; | ||
|
||
//1. presignedUrl 생성요청 | ||
const imageData = { | ||
ownerId: userId, | ||
backgroundExtension: newBackgroundFileList?.[0].type.split('/')[1], | ||
profileExtension: newProfileFileList?.[0].type.split('/')[1], | ||
}; | ||
const response = await axiosInstance.post<UserPresignedUrlsType>('/users/upload-url', imageData); | ||
|
||
//2. presignedUrl에 사진 업로드 | ||
const { backgroundPresignedUrl, profilePresignedUrl } = response?.data; | ||
|
||
if (newBackgroundFileList !== null) { | ||
const resultFile = await compressFile(newBackgroundFileList[0]); | ||
await axios.put(backgroundPresignedUrl, resultFile); | ||
} | ||
|
||
if (newProfileFileList !== null) { | ||
const resultFile = await compressFile(newProfileFileList[0]); | ||
await axios.put(profilePresignedUrl, resultFile); | ||
} | ||
|
||
//3.서버에 성공 알림 | ||
await axiosInstance.post('/users/upload-complete', imageData); | ||
}; | ||
|
||
export default updateProfile; |
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,3 +1,13 @@ | ||
'use client'; | ||
|
||
import useMoveToPage from '@/hooks/useMoveToPage'; | ||
|
||
export default function AccountPage() { | ||
return <div>마이페이지</div>; | ||
const { onClickMoveToPage } = useMoveToPage(); | ||
return ( | ||
<> | ||
<div>마이페이지</div> | ||
<button onClick={onClickMoveToPage('account/profile')}>프로필설정</button> | ||
</> | ||
); | ||
} |
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,48 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const backgroundImageContainer = style({ | ||
maxWidth: 400, | ||
width: '100%', | ||
height: 230, | ||
|
||
display: 'flex', | ||
alignItems: 'center', | ||
|
||
position: 'relative', | ||
|
||
borderRadius: '30px', | ||
|
||
overflow: 'hidden', | ||
}); | ||
|
||
export const transparentBox = style({ | ||
maxWidth: 400, | ||
width: '100%', | ||
height: 230, | ||
padding: '0 23px', | ||
|
||
display: 'flex', | ||
alignItems: 'center', | ||
|
||
position: 'absolute', | ||
|
||
borderRadius: '30px', | ||
}); | ||
|
||
export const profileImageContainer = style({ | ||
width: 90, | ||
height: 90, | ||
|
||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
|
||
position: 'relative', | ||
|
||
backgroundColor: 'white', | ||
|
||
borderRadius: '50%', | ||
border: '3px solid white', | ||
|
||
overflow: 'hidden', | ||
}); |
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 @@ | ||
import Image from 'next/image'; | ||
import * as styles from './ImagePreview.css'; | ||
|
||
interface ImagePreviewProps { | ||
backgroundImageUrl: string; | ||
profileImageUrl: string; | ||
} | ||
|
||
/** TODO: 이미지 에러, 로딩 처리 | ||
* - [ ] placeholder=blur처리 | ||
* - [ ] ONERROR 처리 | ||
*/ | ||
export default function ImagePreview({ backgroundImageUrl, profileImageUrl }: ImagePreviewProps) { | ||
return ( | ||
<div className={styles.backgroundImageContainer}> | ||
{backgroundImageUrl && ( | ||
<> | ||
<Image src={backgroundImageUrl} alt="배경이미지" fill style={{ objectFit: 'cover' }} priority /> | ||
<div className={styles.transparentBox}> | ||
<div className={styles.profileImageContainer}> | ||
<Image src={profileImageUrl} alt="프로필이미지" fill style={{ objectFit: 'cover' }} priority /> | ||
</div> | ||
</div> | ||
</> | ||
)} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.