-
Notifications
You must be signed in to change notification settings - Fork 7
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
14 changed files
with
68 additions
and
66 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
12 changes: 6 additions & 6 deletions
12
frontend/reply-module/src/components/organisms/CommentInput/index.tsx
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
30 changes: 0 additions & 30 deletions
30
frontend/reply-module/src/components/page/CommentPage/index.tsx
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
frontend/reply-module/src/components/pages/CommentPage/index.tsx
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,10 @@ | ||
import { useLogin } from "../../../hooks"; | ||
import CommentArea from "../../templates/CommentArea"; | ||
|
||
const CommentPage = () => { | ||
const { user, login, logout } = useLogin(); | ||
|
||
return <CommentArea user={user} onLogin={login} onLogout={logout} />; | ||
}; | ||
|
||
export default CommentPage; |
File renamed without changes.
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,3 @@ | ||
import useLogin from "./useLogin"; | ||
import useLogout from "./useLogout"; | ||
|
||
export { useLogin, useLogout }; | ||
export { useLogin }; |
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,23 +1,44 @@ | ||
import { QUERY } from "../constants/api"; | ||
import { COOKIE_KEY } from "../constants/cookie"; | ||
import { request } from "../utils/request"; | ||
import { setCookie } from "../utils/cookie"; | ||
import { deleteCookie, setCookie } from "../utils/cookie"; | ||
import { getKakaoAccessToken } from "../utils/kakaoAPI"; | ||
import { useState } from "react"; | ||
import { User } from "../types/user"; | ||
|
||
const dummyUser: User = { | ||
id: 1, | ||
nickName: "도비", | ||
imageURL: | ||
"https://static.independent.co.uk/s3fs-public/thumbnails/image/2015/06/06/15/Chris-Pratt.jpg?width=982&height=726&auto=webp&quality=75", | ||
type: "Signed" | ||
}; | ||
|
||
// TODO: react-query 적용 | ||
const useLogin = () => { | ||
const [user, setUser] = useState<User | null>(null); | ||
|
||
const login = async () => { | ||
try { | ||
const kakaoAccessToken = await getKakaoAccessToken(); | ||
const { data: serverAccessToken } = await request.GET(`${QUERY.LOGIN}${kakaoAccessToken}`); | ||
const { data: serverAccessToken } = await request.get(`${QUERY.LOGIN}${kakaoAccessToken}`); | ||
|
||
setCookie(COOKIE_KEY.ATK, serverAccessToken); | ||
setUser(dummyUser); | ||
} catch (error) { | ||
console.error(error.message); | ||
} | ||
}; | ||
|
||
const logout = async () => { | ||
try { | ||
deleteCookie(COOKIE_KEY.ATK); | ||
setUser(null); | ||
} catch (error) { | ||
console.error(error.message); | ||
} | ||
}; | ||
|
||
return { login }; | ||
return { user, login, logout }; | ||
}; | ||
|
||
export default useLogin; |
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
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