Skip to content

Commit

Permalink
Merge pull request #49 from School-of-Company/chore/simple-function
Browse files Browse the repository at this point in the history
🔀 간단한 기능 개선 진행
  • Loading branch information
Ethen1264 authored Dec 3, 2024
2 parents 6f70f27 + 90bb251 commit 65e0a59
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/widgets/expo-manage/ui/ExpoManageForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const ExpoManageForm = ({ id }: { id: string }) => {
const [requestPrintCategories, setRequestPrintCategories] = useState<
string[]
>(traineeRequestPrintCategories);
const [resetKey, setResetKey] = useState(0);

useEffect(() => {
const fetchExpoData = async () => {
Expand Down Expand Up @@ -80,6 +81,10 @@ const ExpoManageForm = ({ id }: { id: string }) => {
}
}, [selectOption]);

useEffect(() => {
setResetKey((prevKey) => prevKey + 1);
}, [selectOption]);

return (
<div className="mx-auto w-full max-w-[1200px] space-y-[30px] px-5">
<SelectUserType
Expand All @@ -88,6 +93,7 @@ const ExpoManageForm = ({ id }: { id: string }) => {
onChange={(value) => setSelectOption(value)}
/>
<TableForm
key={resetKey}
categories={requestPrintCategories}
data={expoData}
maxHeight="414px"
Expand Down
5 changes: 4 additions & 1 deletion src/widgets/program-detail/ui/ProgramDetailForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import axios from 'axios';
import { useSearchParams } from 'next/navigation';
import React, { useEffect, useState } from 'react';
import { fileActions } from '@/shared/model/footerActions';
import { TableForm } from '@/shared/ui/Table';

interface TrainingProgram {
Expand All @@ -29,7 +30,7 @@ interface StandardProgram {

const ProgramDetailForm = ({ id }: { id: number }) => {
const searchParams = useSearchParams();
const navigation = searchParams.get('navigation') || 'standard'; // URL 쿼리 파라미터에서 navigation 값 가져오기
const navigation = searchParams.get('navigation') || 'standard';
const [data, setData] = useState<TrainingProgram[] | StandardProgram[]>([]);

useEffect(() => {
Expand All @@ -56,6 +57,7 @@ const ProgramDetailForm = ({ id }: { id: number }) => {
'성명',
'소속',
'직급',
'프로그램 이름',
'출석 여부',
'입실 시간',
'퇴실 시간',
Expand All @@ -70,6 +72,7 @@ const ProgramDetailForm = ({ id }: { id: number }) => {
maxHeight="414px"
footerType="file"
text="인원 수"
actions={fileActions(id)}
/>
</div>
);
Expand Down
6 changes: 6 additions & 0 deletions src/widgets/program/ui/ProgramForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const ProgramForm = ({ id }: { id: string }) => {
const searchParams = useSearchParams();
const navigation = searchParams.get('navigation') || 'standard';
const [expoData, setExpoData] = useState<Program[]>([]);
const [resetKey, setResetKey] = useState(0);
const router = useRouter();

const requestPrintCategories = useMemo(() => {
Expand All @@ -45,10 +46,15 @@ const ProgramForm = ({ id }: { id: string }) => {
fetchExpoData();
}, [id, navigation]);

useEffect(() => {
setResetKey((prevKey) => prevKey + 1);
}, [navigation]);

return (
<div className="mx-auto w-full max-w-[1200px] space-y-[46px] px-5">
<ProgramNavigation />
<TableForm
key={resetKey}
categories={requestPrintCategories}
data={expoData}
maxHeight="414px"
Expand Down

0 comments on commit 65e0a59

Please sign in to comment.