-
Notifications
You must be signed in to change notification settings - Fork 51
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 #555 from aowjarkwk/part3-윤대호-week19
[윤대호] week19
- Loading branch information
Showing
32 changed files
with
718 additions
and
413 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
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,19 @@ | ||
import { useSession } from "next-auth/react"; | ||
import { useRouter } from "next/router"; | ||
import { ComponentType, useEffect } from "react"; | ||
|
||
const WithAuth = <P extends {}>(Component: ComponentType<P>) => { | ||
return function AuthenticatedComponent(props: P) { | ||
const { data: session, status } = useSession(); | ||
const router = useRouter(); | ||
|
||
useEffect(() => { | ||
if (status === "loading") return; | ||
if (!session) router.push("/user/signin"); | ||
}, [session, status, router]); | ||
|
||
return <Component {...props} />; | ||
}; | ||
}; | ||
|
||
export default WithAuth; |
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,13 +1,11 @@ | ||
import * as S from "@/components/inputField/InputField.style"; | ||
import { useState } from "react"; | ||
|
||
interface InputFieldProps { | ||
modalTarget: string; | ||
value: string; | ||
onChange: (value: string) => void; | ||
} | ||
|
||
const InputField = ({ modalTarget }: InputFieldProps) => { | ||
const [value, setValue] = useState(modalTarget); | ||
return <S.Input value={value} onChange={(e) => setValue(e.target.value)} placeholder="내용 입력" />; | ||
const InputField = ({ value, onChange }: InputFieldProps) => { | ||
return <S.Input value={value} onChange={(e) => onChange(e.target.value)} placeholder="내용 입력" />; | ||
}; | ||
|
||
export default InputField; |
Oops, something went wrong.