Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

상/벌점 부여 취소 모달 버그 수정 #37

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .yarn/sdks/prettier/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier
// Setup the environment to be able to require prettier/index.js
require(absPnpApiPath).setup();
}
}

// Defer to the real prettier your application uses
module.exports = absRequire(`prettier`);
// Defer to the real prettier/index.js your application uses
module.exports = absRequire(`prettier/index.js`);
24 changes: 2 additions & 22 deletions services/admin/src/components/main/PointList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@ import { useQueryClient } from '@tanstack/react-query';
export function PointList() {
const { modalState, closeModal, selectModal } = useModal();
const [pointHistoryId] = usePointHistoryId((state) => [state.pointHistoryId]);
const { data, refetch: refetchAllPointHistory } = useAllPointHistory('ALL');
const cancelPoint = useCancelPointHistory(pointHistoryId, {
onSuccess: () => refetchAllPointHistory(),
});
const { data } = useAllPointHistory('ALL');

const openPointOptionModal = () => selectModal('POINT_OPTIONS');

const { data: allPointOptions } = usePointOptionList();

const { toastDispatch } = useToast();

const { mutate: downloadPointHistory } = useDownloadPointHistoryExcel();

const [selectedPointOption, setSelectedPointOption] =
useSelectedPointOptionStore((state) => [
state.selectedPointOption,
Expand Down Expand Up @@ -96,22 +92,6 @@ export function PointList() {
</>
);
})}
{modalState.selectedModal === 'DELETE_POINT_LIST' && (
<DeletePointListModal onClick={cancelPoint.mutate} />
)}
{modalState.selectedModal === 'POINT_OPTIONS' && (
<ViewPointOptionsModal
selectedPointOption={selectedPointOption}
setSelectedPointOption={setSelectedPointOption}
allPointOptions={allPointOptions}
/>
)}
{modalState.selectedModal === 'DELETE_POINT_OPTION' && (
<DeletePointOptionModal
setSelectedOption={setSelectedPointOption}
onClick={deletePointOptionAPI.mutate}
/>
)}
</_Wrapper>
);
}
Expand Down
3 changes: 2 additions & 1 deletion services/admin/src/components/main/StudentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ export function StudentList({
isOpened={openAllPointHistorySideBar}
title="상/벌점 내역"
close={() => {
setOpenAllPointHistorySideBar(false);
modalState.selectedModal === 'DELETE_POINT_LIST' ||
setOpenAllPointHistorySideBar(false);
}}
>
<PointList />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { usePointHistoryList } from '@/hooks/usePointHistoryList';
import { useToast } from '@/hooks/useToast';
import { useSelectedStudentIdStore } from '@/store/useSelectedStudentIdStore';
import { useModal } from '@/hooks/useModal';
import { useQueryClient } from '@tanstack/react-query';

interface PropsType {
allPointOptions: AllPointsOptionResponse;
Expand Down Expand Up @@ -79,6 +80,9 @@ export function GivePointOptionsModal({ allPointOptions }: PropsType) {
setNewItem(true);
}
};

const queryClient = useQueryClient();

const { addPointOptionToStudents } = usePointHistoryList();
const givePointOptionAPI = useGivePointOption(
selectedPointOption.id,
Expand All @@ -95,6 +99,7 @@ export function GivePointOptionsModal({ allPointOptions }: PropsType) {
toastType: 'SUCCESS',
message: `${PointEnum[selectedPointOption.type]}이 부여되었습니다.`,
});
queryClient.invalidateQueries(['getAllPointHistory']);
reresetStudentIdset();
setSelectedPointOption({
id: '',
Expand Down