Skip to content

Commit

Permalink
Merge pull request #350 from New-Barams/feat/#348/is-my-plan-store
Browse files Browse the repository at this point in the history
[노철]- isMyPlan store
  • Loading branch information
qkdl60 authored Dec 29, 2023
2 parents a780b6c + 69479a3 commit bddfecf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/app/(header)/plans/[planId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import { useDeletePlanMutation } from '@/hooks/apis/useDeletePlanMutation';
import { useGetPlanQuery } from '@/hooks/apis/useGetPlanQuery';
import { useIsLogIn } from '@/hooks/useIsLogIn';
import { useScroll } from '@/hooks/useScroll';
import { isMyPlanStore } from '@/stores/isMyPlanStore';
import { checkIsSeason } from '@/utils/checkIsSeason';
import classNames from 'classnames';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import { useEffect, useState } from 'react';
import { useSetRecoilState } from 'recoil';
import './index.scss';

export default function PlanIdPage({ params }: { params: { planId: string } }) {
Expand All @@ -25,6 +27,13 @@ export default function PlanIdPage({ params }: { params: { planId: string } }) {
const [isDeletePlanModalOpen, setIsDeletePlanModalOpen] = useState(false);
const { handleScroll, scrollableRef } = useScroll();
const { mutate: deletePlanAPI } = useDeletePlanMutation();
const setIsMyPlanStore = useSetRecoilState(isMyPlanStore);
useEffect(() => {
setIsMyPlanStore(isMyPlan);
return () => {
setIsMyPlanStore(false);
};
}, [setIsMyPlanStore, isMyPlan]);

const handleModalClickYes = () => {
setIsDeletePlanModalOpen(false);
Expand Down
6 changes: 6 additions & 0 deletions src/stores/isMyPlanStore.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { atom } from 'recoil';

export const isMyPlanStore = atom<boolean>({
key: 'isMyPlan',
default: false,
});

0 comments on commit bddfecf

Please sign in to comment.