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

๐Ÿ”€ ๊ฐ„๋‹จํ•œ ๊ธฐ๋Šฅ ๊ฐœ์„  ์ง„ํ–‰ #49

Merged
merged 1 commit into from
Dec 3, 2024
Merged
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: 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
Loading