-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[박상준] Week15 #476
Merged
o-seung-yeon
merged 34 commits into
codeit-bootcamp-frontend:part3-박상준
from
sj0724:part3-박상준-week15
May 29, 2024
The head ref may contain hidden characters: "part3-\uBC15\uC0C1\uC900-week15"
Merged
[박상준] Week15 #476
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
bbc1f6d
fix: 인풋사용하는 컴포넌트 react-hook-form으로 변경
sj0724 8561791
fix: 메인페이지 이미지태그로 변경
sj0724 d64a7fe
fix: 모달동작시 동작 로직 수정
sj0724 c10ef9a
fix: axios intercepros 적용, 토큰 자동 기입
sj0724 f8122ea
feat: 폴더 이동시 쿼리 변경, 퀴리값 사용해서 폴더 링크 로딩, 존재하지 않는 폴더 요청시 페이지 구성
sj0724 3113144
feat: kebab 외부 클릭시 kebab 닫기 구현
sj0724 1466e44
fix: 동적 라우팅, 옵셔널 세그먼트로 변경
sj0724 a189e41
fix: card 컴포넌트 Image태그로 최적화
sj0724 6086486
fix: 이미지 태그로 변경
sj0724 48461bf
fix: 옵저버 인식 안되는 버그수정
sj0724 43f6c23
fix: notfound 컴포넌트 구현 카드 컴포넌트 css 수정
sj0724 c59d505
fix: card 컴포넌트 이미지파일로 수정 및 css 수정
sj0724 f7b0de1
feat: 링크 복사 기능 구현
sj0724 c5e2154
feat: 폴더 공유시 toast구현
sj0724 bbfe19b
fix: 이미지 경로 404일때 로고 표시
sj0724 c3c79cd
feat: 쿼리파라미터로 유저 정보 조회 구현
sj0724 9f817c8
feat: kakao 공유하기 구현
sj0724 2d1c86c
feat: facebook 공유 기능 구현
sj0724 d29c8fd
fix: 코드리뷰 사항 수정
sj0724 57c9514
fix: 메인 섹션 카드 css수정
sj0724 8325141
fix: 메인 페이지, 로그인, 회원가입 반응형 수정
sj0724 5a88f7d
fix: 폴더 페이지 접근시 토큰없으면 메인 이동, 버튼 반응형 수정
sj0724 4611416
fix: 케밥 위치 조정
sj0724 74c431b
fix: 링크 삭제시 다른 링크 삭제되는 버그 수정
sj0724 6042f20
feat: 폴더 이름 변경 기능 구현
sj0724 6196cc7
fix: 파일 수정 확인용 커밋
sj0724 70c346c
fix: env파일 수정
sj0724 bcc48ac
feat: 로딩 컴포넌트 구현
sj0724 df5ea65
fix: 검색기능 옵셔널 체이닝으로 변경
sj0724 64b7386
fix: shared 페이지 라우터 쿼리에서 userid값 제거
sj0724 12719d7
fix: card css수정
sj0724 1015c20
fix: 폴더 추가, 링크 검색 글자수 제한 설정
sj0724 297e423
fix: prerender시점에서 css도 포함해서 렌더링하도록 설정
sj0724 e865644
fix: 레이아웃 쉬프트 방지 및 메인 페이지 이미지 css수정
sj0724 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ yarn-error.log* | |
|
||
# local env files | ||
.env*.local | ||
.env | ||
|
||
# vercel | ||
.vercel | ||
|
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,3 @@ | ||
{ | ||
"cSpell.words": ["Linkbrary"] | ||
} |
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,5 @@ | ||
declare namespace NodeJS { | ||
interface ProcessEnv { | ||
NEXT_PUBLIC_BASE_URL: string; | ||
} | ||
} |
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,4 +1,17 @@ | ||
import axios from '../../instance/instance'; | ||
import axios from '../instance/instance'; | ||
|
||
axios.interceptors.request.use( | ||
(config) => { | ||
const accessToken = localStorage.getItem('token'); | ||
config.headers['Authorization'] = accessToken; | ||
|
||
return config; | ||
}, | ||
(error) => { | ||
console.log(error); | ||
return Promise.reject(error); | ||
} | ||
); | ||
|
||
Comment on lines
+3
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 헤더 값을 일괄적으로 적용해주셨네요 👍 |
||
export async function getSampleUser() { | ||
try { | ||
|
@@ -49,7 +62,17 @@ export async function getFolder(id: string) { | |
} | ||
} | ||
|
||
export async function getFolderList(id: string, folderId: number) { | ||
export async function getFolderData(folderId: string) { | ||
try { | ||
const { data } = await axios.get(`/folders/${folderId}`); | ||
return data.data; | ||
} catch (error) { | ||
console.error('Error fetching folder:', error); | ||
throw error; | ||
} | ||
} | ||
|
||
export async function getFolderList(id: string, folderId: string) { | ||
if (folderId) { | ||
try { | ||
const query = `/${id}/links?folderId=${folderId}`; | ||
|
@@ -85,14 +108,23 @@ export async function getUser(accessToken: string) { | |
} | ||
} | ||
|
||
export async function getUserData(id: string) { | ||
try { | ||
const { data } = await axios.get(`/users/${id}`); | ||
return data.data; | ||
} catch (error) { | ||
console.error('Error fetching user:', error); | ||
throw error; | ||
} | ||
} | ||
|
||
export async function postSignIn(id: string, password: string) { | ||
try { | ||
const { data } = await axios.post('/sign-in', { | ||
email: id, | ||
password: password, | ||
}); | ||
localStorage.setItem('token', data.data.accessToken); | ||
window.location.href = '/'; | ||
return data; | ||
} catch (error) { | ||
console.error('Error fetching sign-in:', error); | ||
|
@@ -120,7 +152,6 @@ export async function postSignUp(id: string, password: string) { | |
}); | ||
localStorage.setItem('token', data.data.accessToken); | ||
alert('회원가입이 완료되었습니다!'); | ||
window.location.href = '/'; | ||
return data; | ||
} catch (error) { | ||
console.error('Error fetching sign-in:', error); | ||
|
@@ -130,53 +161,31 @@ export async function postSignUp(id: string, password: string) { | |
|
||
export async function postFolder(name: string) { | ||
try { | ||
const token = localStorage.getItem('token'); | ||
const { data } = await axios.post( | ||
'/folders', | ||
{ | ||
name: name, | ||
}, | ||
{ | ||
headers: { | ||
Authorization: token, | ||
}, | ||
} | ||
); | ||
return data; | ||
const { data } = await axios.post('/folders', { | ||
name: name, | ||
}); | ||
return data.data; | ||
} catch (error) { | ||
console.error('Error fetching post folder:', error); | ||
} | ||
} | ||
|
||
export async function deleteFolder(folderId: number) { | ||
export async function deleteFolder(folderId: string) { | ||
try { | ||
const token = localStorage.getItem('token'); | ||
const { data } = await axios.delete(`/folders/${folderId}`, { | ||
headers: { | ||
Authorization: token, | ||
}, | ||
}); | ||
const { data } = await axios.delete(`/folders/${folderId}`); | ||
return data; | ||
} catch (error) { | ||
console.error('Error fetching post folder:', error); | ||
} | ||
} | ||
|
||
export async function postLink(folderId: number, url: string) { | ||
export async function postLink(folderId: string, url: string) { | ||
try { | ||
const token = localStorage.getItem('token'); | ||
const { data } = await axios.post( | ||
'/links', | ||
{ | ||
url: url, | ||
folderId: folderId, | ||
}, | ||
{ | ||
headers: { | ||
Authorization: token, | ||
}, | ||
} | ||
); | ||
const { data } = await axios.post('/links', { | ||
url: url, | ||
folderId: folderId, | ||
}); | ||
return data; | ||
} catch (error) { | ||
alert('url과 폴더를 지정해주세요!'); | ||
|
@@ -186,14 +195,21 @@ export async function postLink(folderId: number, url: string) { | |
|
||
export async function deleteLink(linkId: number) { | ||
try { | ||
const token = localStorage.getItem('token'); | ||
const { data } = await axios.delete(`/links/${linkId}`, { | ||
headers: { | ||
Authorization: token, | ||
}, | ||
}); | ||
const { data } = await axios.delete(`/links/${linkId}`); | ||
return data; | ||
} catch (error) { | ||
console.error('Error fetching post folder:', error); | ||
} | ||
} | ||
|
||
export async function putFolder(folderId: string, name: string) { | ||
try { | ||
const { data } = await axios.put(`/folders/${folderId}`, { | ||
name: name, | ||
}); | ||
return data; | ||
} catch (error) { | ||
alert('이름 수정에 실패했습니다!'); | ||
console.error('Error fetching put folder:', error); | ||
} | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.vscode 폴더도 추가해주세요~!