Skip to content

Commit

Permalink
[Issue#88] 리로드 없이 라이센스 조회 (#89)
Browse files Browse the repository at this point in the history
* [Feat] 작가 포토폴리오 init

* [Feat] 라이센스 추가 콘솔에 로그

* [Feat] 라이센스 조회

* [Chore] LicenceDialog 컴포넌트로 이동

* [Style] 라이센스 리스트

* [Feat} api init

* [Feat] 라이센스 추가

* [Feat] 라이센스 조회, alert -> sweetAlert

* 등록 후 refresh

* [Fix] 라이센스 조회 무한루프

* [Fix] 라이센스 조회 무한루프

* [Perf] 리로드 없이 라이센스 조회
  • Loading branch information
heeoneie authored Oct 10, 2023
1 parent 04f1417 commit badabc4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/component/license/LicenseDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import dayjs from "dayjs";
import { createLicense } from "../../axios/License";
import Swal from "sweetalert2";

const LicenseDialog = ({ open, onClose }) => {
const LicenseDialog = ({ open, onClose, getLicenses }) => {
const [data, setData] = useState({
artistName: "",
artName: "",
Expand All @@ -38,7 +38,7 @@ const LicenseDialog = ({ open, onClose }) => {
title: "라이센스 등록에 성공했습니다!",
text: `행사 기간은: ${data.startDate} ~ ${data.endDate}까지 입니다`,
icon: "success",
}).then(() => window.location.reload());
}).then(() => getLicenses());
})
.catch(() => {
Swal.fire({
Expand Down
13 changes: 11 additions & 2 deletions src/screen/License.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ const License = () => {
const [open, setOpen] = useState(false);
const [licenses, setLicenses] = useState([]);
useEffect(() => {
getLicenses();
}, []);
const getLicenses = () => {
getLicenseList().then((res) => {
setLicenses(res.data);
});
}, []);
};
const openDialog = () => {
setOpen(true);
};
Expand Down Expand Up @@ -75,7 +78,13 @@ const License = () => {
);
})}
</ProductBox>
{open && <LicenseDialog open={open} onClose={closeDialog} />}
{open && (
<LicenseDialog
open={open}
onClose={closeDialog}
getLicenses={getLicenses}
/>
)}
</Container>
</Box>
</MainContainer>
Expand Down

0 comments on commit badabc4

Please sign in to comment.