Skip to content

Commit

Permalink
fix: 동아리 정보 로고 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Kangyeeun0 committed Nov 11, 2024
1 parent b89f114 commit 7abb379
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
15 changes: 9 additions & 6 deletions src/component/admin/EditPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export default function EditPage() {
const [isErrorModalOpen, setIsErrorModalOpen] = useState(false);
const [modalMessage, setModalMessage] = useState('');
const [extension, setExtension] = useState('');
// const [cIntroduction, setcIntroduction] = useState('');
const [imgType, setImageType] = useState('0');
//->이미지 파일 선택 시 imaType=1, 로고 삭제 시, imgType=2, 미변경시 imgType=0

// console.log('bb', baseLogoUrl);
const closeModal = () => {
Expand Down Expand Up @@ -96,7 +97,7 @@ export default function EditPage() {
const handleFileChange = async (event) => {
const file = event.target.files[0];
if (!file) return; // 파일이 없을 경우 처리 종료

setImageType('1');
setImageFile(file);
setImagePreview(URL.createObjectURL(file));

Expand All @@ -106,8 +107,9 @@ export default function EditPage() {
const deleteImage = async () => {
if (!imageUrl) return;
try {
setImageUrl(`http://dev.ssuclubber.com/${baseLogoUrl}`);
setImagePreview(`http://dev.ssuclubber.com/${baseLogoUrl}`);
setImageType('2');
setImageUrl(`common/logo/soongsil_default.png `);
setImagePreview(`https://image.ssuclubber.com/common/logo/soongsil_default.png `);
} catch (error) {
console.error('이미지 삭제 실패:', error);
alert('이미지 삭제에 실패했습니다.');
Expand All @@ -123,9 +125,10 @@ export default function EditPage() {
setIsErrorModalOpen(true);
setModalMessage("'📌 소개 ' 는 최대 100자까지 작성 가능합니다. ");
} else {
if (imagePreview) {
if (imgType === '1') {
try {
// presigned URL을 가져오는 API 호출

const { data } = await customAxios.post(
'/v1/images/club/logo',

Expand All @@ -141,7 +144,7 @@ export default function EditPage() {
},
}
);
console.log(data.data);
// console.log(data.data);
setImageUrl(data.data.imageKey);

// 이미지 파일을 presigned URL로 업로드
Expand Down
4 changes: 2 additions & 2 deletions src/component/admin/recruit/AdminRecruitList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export default function AdminRecruitList() {
params: {
page: page,
size: pageSize,
// sort: ['string'],
},
});
if (res.data.success) {
// console.log(res.data);
console.log(res.data);
setPromoteData(res.data.data.content);
setTotalPages(res.data.data.totalPages);
console.log(res.data.data.content);
}
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion src/component/recruit/RecruitList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function RecruitList() {
if (res.data.success) {
setPromoteData(res.data.data.content);
setTotalPages(res.data.data.totalPages);
console.log(res.data.data.content);
console.log(res.data.data);
}
} catch (error) {
console.error('Error fetching data : ', error);
Expand Down

0 comments on commit 7abb379

Please sign in to comment.