Skip to content

Commit

Permalink
feat: myTeamAtom 구조 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
llddang committed Sep 22, 2024
1 parent 934f6ff commit 49fb13e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/app/team/[teamId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ const Page = ({ params }: { params: { teamId: number } }) => {
const myTeam = useAtomValue(myTeamAtom);
const [isMyTeam, setIsMyTeam] = useState<boolean>(false);
useEffect(() => {
if (myTeam.teams !== undefined) {
const res = myTeam.teams.filter((teamId) => teamId === params.teamId);
if (myTeam !== undefined) {
const res = myTeam.filter((teamId) => teamId === Number(params.teamId));
setIsMyTeam(res.length === 1);
}
}, [myTeam, params.teamId]);
Expand Down
4 changes: 1 addition & 3 deletions src/atom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export const defaultUserAtom = {

export const userAtom = atomWithStorage('user', defaultUserAtom as UserAtomType);

export const myTeamAtom = atomWithStorage<{ teams: number[] }>('myTeam', {
teams: [],
});
export const myTeamAtom = atomWithStorage('myTeam', []);

export const loginBackPathAtom = atomWithStorage('loginBackPath', '/');

0 comments on commit 49fb13e

Please sign in to comment.