Skip to content

Commit

Permalink
Merge pull request #69 from turkey-kim/refact/gallery
Browse files Browse the repository at this point in the history
Refact/gallery: any type 변경 및 로딩 시간 상수화 작업
  • Loading branch information
turkey-kim authored Sep 21, 2023
2 parents 10f8ebf + 4315822 commit 1f91dd1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/components/Gallery/Album.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import AddPhotos from "./AddPhotos";
import UploadModal from "./UploadModal";
import {ReactComponent as DeleteBtn} from "../../assets/icons/DeleteBtn.svg";
import {ReactComponent as Upload} from "../../assets/icons/Upload.svg";
import {LOADING_TIME} from "../../constant";

function Album() {
const {id} = useParams<{id: string}>();
Expand All @@ -35,7 +36,7 @@ function Album() {
setIsLoading(true);
setTimeout(() => {
setIsLoading(false);
}, 1000);
}, LOADING_TIME);
}, [id]);

useEffect(() => {
Expand All @@ -48,7 +49,7 @@ function Album() {
setFiles(photoFiles);
setTimeout(() => {
setIsLoading(false);
}, 1000);
}, LOADING_TIME);
})
.catch(err => {
throw new Error(err);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Gallery/DeletePhotos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function DeletePhotos(

const imagesCollection = collection(db, albumKey);
const imgSnapshot = await getDocs(imagesCollection);
const deletionPromises: any[] = [];
const deletionPromises: object[] = [];

imgSnapshot.forEach(async docs => {
try {
Expand Down
3 changes: 2 additions & 1 deletion src/components/Wiki/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import EditButton from "./EditButton";
import TeamContent from "./TeamContent";
import OtherContent from "./OtherContent";
import {ReactComponent as RefreshIcon} from "../../assets/icons/Refresh.svg";
import {LOADING_TIME} from "../../constant";

function Content() {
const {id} = useParams() as {id: string};
Expand Down Expand Up @@ -56,7 +57,7 @@ function Content() {

setTimeout(() => {
setisLoading(false);
}, 1000);
}, LOADING_TIME);
}, [id]);

useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/constant/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// 랭킹 페이지 URL
export const RANKING_URL = "https://techschool-wiki.web.app/ranking";

// 이거는 다음분이 지우셔도 됩니다!
export const NOTHING = "nothing!";
// 로딩 setTimeout 시간
export const LOADING_TIME = 1000;

0 comments on commit 1f91dd1

Please sign in to comment.