-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #322 from Injaeeee/Next-정인재-Sprint11
[정인재] Sprint11
- Loading branch information
Showing
29 changed files
with
950 additions
and
41 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
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,45 @@ | ||
import { ChangeEventHandler, FocusEventHandler } from "react"; | ||
import styled from "styled-components"; | ||
|
||
interface InputType { | ||
id: string; | ||
name: string; | ||
type: string; | ||
placeholder: string; | ||
onChange?: ChangeEventHandler<HTMLInputElement>; | ||
onBlur?: FocusEventHandler<HTMLInputElement>; | ||
hasError?: boolean; | ||
} | ||
|
||
export default function PrimaryInput({ | ||
id, | ||
name, | ||
type, | ||
placeholder, | ||
onChange, | ||
onBlur, | ||
hasError, | ||
}: InputType) { | ||
return ( | ||
<Input | ||
id={id} | ||
name={name} | ||
type={type} | ||
placeholder={placeholder} | ||
onChange={onChange} | ||
onBlur={onBlur} | ||
hasError={hasError} | ||
/> | ||
); | ||
} | ||
|
||
const Input = styled.input<{ hasError?: boolean }>` | ||
width: 100%; | ||
border-radius: 12px; | ||
padding: 16px 24px; | ||
background-color: #f3f4f6; | ||
color: #9ca3af; | ||
font-size: 16px; | ||
font-weight: 400; | ||
border: ${({ hasError }) => (hasError ? "1px solid red" : "none")}; | ||
`; |
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.
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.
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.
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,10 +1,11 @@ | ||
export interface articleType { | ||
title: string; | ||
content: string; | ||
image: string; | ||
image: string | null; | ||
} | ||
|
||
export interface FileInputType { | ||
value: File | null; | ||
onChange: (file: File | null) => void; | ||
fileChange: (file: File | null) => void; | ||
previewChange: (preview: string | null) => void; | ||
} |
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,6 @@ | ||
export interface UserInfo { | ||
email: string; | ||
nickname?: string; | ||
password: string; | ||
passwordConfirmation?: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,52 @@ | ||
import axios from "axios"; | ||
import axios, { AxiosError } from "axios"; | ||
|
||
const instance = axios.create({ | ||
baseURL: " https://panda-market-api.vercel.app/", | ||
}); | ||
|
||
// 요청 인터셉터 | ||
instance.interceptors.request.use( | ||
(config) => { | ||
// 요청이 가기 전에 할 작업 | ||
// 예: 인증 토큰 추가 | ||
const token = localStorage.getItem("access_token"); | ||
if (token) { | ||
config.headers.Authorization = `Bearer ${token}`; | ||
} | ||
return config; | ||
}, | ||
(error) => { | ||
// 요청 에러 처리 | ||
return Promise.reject(error); | ||
} | ||
); | ||
|
||
// 응답 인터셉터 | ||
instance.interceptors.response.use( | ||
(response) => { | ||
// 응답 데이터 처리 | ||
return response; | ||
}, | ||
(error: AxiosError) => { | ||
// 응답 에러 처리 | ||
if (axios.isAxiosError(error)) { | ||
if (error.response) { | ||
// 서버 응답이 있는 경우 | ||
console.error("서버 에러:", error.response.data); | ||
alert("유효하지 않은 아이디 입니다."); | ||
} else if (error.request) { | ||
// 요청이 보내졌으나 응답이 없는 경우 | ||
console.error("요청 에러:", error.request); | ||
} else { | ||
// 에러를 발생시킨 요청 구성 문제 | ||
console.error("에러 구성:", error.message); | ||
} | ||
} else { | ||
// Axios가 아닌 다른 에러 | ||
console.error("기타 에러:", error); | ||
} | ||
return Promise.reject(error); | ||
} | ||
); | ||
|
||
export default instance; |
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.