-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/side-peek/sidepeek_frontend …
…into feature/#47/team
- Loading branch information
Showing
72 changed files
with
1,186 additions
and
276 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { deleteLikePayload } from "api-models" | ||
import { AxiosRequestConfig } from "axios" | ||
|
||
import { authInstance } from "@apis/axiosInstance" | ||
|
||
import { ENDPOINTS } from "@constants/endPoints" | ||
|
||
export const deleteLike = async ( | ||
{ likeId }: deleteLikePayload, | ||
config: AxiosRequestConfig = {}, | ||
) => { | ||
await authInstance.delete(ENDPOINTS.DELETE_LIKE(likeId)), | ||
{ | ||
...config, | ||
} | ||
} |
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,15 @@ | ||
import { postLikePayload } from "api-models" | ||
import { AxiosRequestConfig } from "axios" | ||
|
||
import { ENDPOINTS } from "@constants/endPoints" | ||
|
||
import { authInstance } from "../axiosInstance" | ||
|
||
//FIXME: 미완성 api | ||
export const postLike = async () => { | ||
await authInstance.post(ENDPOINTS.UPLOAD_LIKE) | ||
export const postLike = async ( | ||
{ ...data }: postLikePayload, | ||
config: AxiosRequestConfig = {}, | ||
) => { | ||
await authInstance.post(ENDPOINTS.POST_LIKE, data, { | ||
...config, | ||
}) | ||
} |
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,22 @@ | ||
import { baseInstance } from "@api/axiosInstance" | ||
import { getUserProjectsPayload } from "api-models" | ||
|
||
import { ENDPOINTS } from "@constants/endPoints" | ||
|
||
interface PaginationQueryStringProps { | ||
page: number | ||
size: number | ||
} | ||
|
||
export const getUserProjects = async ({ | ||
userId, | ||
type, | ||
page, | ||
size, | ||
}: getUserProjectsPayload & PaginationQueryStringProps) => { | ||
// TODO: type이 LIKED, COMMENT일 경우 분기처리(authInstance 사용) | ||
const { data } = await baseInstance.get( | ||
ENDPOINTS.GET_USER_PROJECTS(userId, type, page, size), | ||
) | ||
return data | ||
} |
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,52 @@ | ||
import { cloneElement, isValidElement } from "react" | ||
import { useFormContext } from "react-hook-form" | ||
|
||
import { | ||
Flex, | ||
FormControl, | ||
FormErrorMessage, | ||
FormLabel, | ||
InputProps, | ||
Spacer, | ||
} from "@chakra-ui/react" | ||
import { isFunction } from "lodash" | ||
|
||
import { InputControllerProps } from "./types/InputControllerProps" | ||
|
||
const InputController = ({ | ||
children, | ||
fieldName, | ||
label, | ||
registerOptions, | ||
}: InputControllerProps) => { | ||
const { | ||
register, | ||
getFieldState, | ||
formState: { errors }, | ||
} = useFormContext() | ||
|
||
const renderPorps = { | ||
height: "5rem", | ||
fontSize: "2rem", | ||
...register(fieldName, registerOptions), | ||
} as InputProps | ||
|
||
return ( | ||
<FormControl isInvalid={getFieldState(fieldName).invalid}> | ||
<Flex alignItems="center"> | ||
<FormLabel display="inline-block">{label}</FormLabel> | ||
<Spacer /> | ||
<FormErrorMessage> | ||
{errors[fieldName]?.message as string} | ||
</FormErrorMessage> | ||
</Flex> | ||
{isValidElement(children) | ||
? cloneElement(children, renderPorps) | ||
: isFunction(children) | ||
? children(renderPorps) | ||
: null} | ||
</FormControl> | ||
) | ||
} | ||
|
||
export default InputController |
13 changes: 13 additions & 0 deletions
13
src/components/InputController/types/InputControllerProps.ts
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,13 @@ | ||
import { ReactNode } from "react" | ||
import { FieldValues, RegisterOptions } from "react-hook-form" | ||
|
||
import { InputProps } from "@chakra-ui/input" | ||
|
||
import { FieldNames } from "./fieldNames" | ||
|
||
export interface InputControllerProps { | ||
fieldName: FieldNames | ||
children: ReactNode | ((renderProps: InputProps) => ReactNode) | ||
label?: string | ||
registerOptions: RegisterOptions<FieldValues> | ||
} |
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 @@ | ||
export type FieldNames = "email" | "password" | "nickname" | "confirmPassword" |
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 |
---|---|---|
@@ -1,6 +1,4 @@ | ||
export const QUERYKEY = { | ||
EMAIL_DOUBLE_CHECK: "emailDoubleCheck", | ||
NICKNAME_DOUBLE_CHECK: "nicknameDoubleCheck", | ||
USER_INFO: "userInfo", | ||
TECH_STACKS: "techStacks", | ||
} |
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
Oops, something went wrong.