-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(member): rename user to member
- Loading branch information
1 parent
de23f80
commit 29cbb7d
Showing
110 changed files
with
1,062 additions
and
1,047 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from "./user"; | ||
export * from "./member"; | ||
export * from "./recruitments"; | ||
export * from "./applicationForms"; |
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,14 @@ | ||
import { useContext, createContext } from "react"; | ||
import { ERROR_MESSAGE } from "../constants/messages"; | ||
|
||
export const MemberInfoContext = createContext(); | ||
|
||
const useMemberInfoContext = () => { | ||
const memberInfoContext = useContext(MemberInfoContext); | ||
|
||
if (!memberInfoContext) throw Error(ERROR_MESSAGE.HOOKS.CANNOT_FIND_MEMBER_INFO_CONTEXT); | ||
|
||
return memberInfoContext; | ||
}; | ||
|
||
export default useMemberInfoContext; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -544,7 +544,7 @@ export const missionsDummy = { | |
], | ||
}; | ||
|
||
export const userInfoDummy = { | ||
export const memberInfoDummy = { | ||
id: 1, | ||
name: "썬", | ||
email: "[email protected]", | ||
|
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,44 @@ | ||
import React, { useEffect, useState } from "react"; | ||
|
||
import * as Api from "../api"; | ||
import { ERROR_MESSAGE } from "../constants/messages"; | ||
import useTokenContext from "../hooks/useTokenContext"; | ||
import { MemberInfoContext } from "../hooks/useMemberInfoContext"; | ||
|
||
const MemberInfoProvider = ({ children }) => { | ||
const [memberInfo, setMemberInfo] = useState(null); | ||
const { token } = useTokenContext(); | ||
|
||
const handleFetchError = (error) => { | ||
if (!error) return; | ||
|
||
alert(ERROR_MESSAGE.API.FETCHING_MEMBER_INFO); | ||
}; | ||
|
||
const initMemberInfo = async () => { | ||
try { | ||
const { data } = await Api.fetchMemberInfo({ token }); | ||
|
||
setMemberInfo(data); | ||
} catch (error) { | ||
handleFetchError(error); | ||
} | ||
}; | ||
|
||
const updateMemberInfo = async (payload) => { | ||
await Api.fetchMemberInfoEdit({ token, ...payload }); | ||
setMemberInfo((prev) => ({ ...prev, ...payload })); | ||
}; | ||
|
||
useEffect(() => { | ||
initMemberInfo(); | ||
}, [token]); | ||
|
||
return ( | ||
<MemberInfoContext.Provider value={{ memberInfo, updateMemberInfo }}> | ||
{children} | ||
</MemberInfoContext.Provider> | ||
); | ||
}; | ||
|
||
export default MemberInfoProvider; |
Oops, something went wrong.