Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
๐Ÿ› fix #197 : ์•จ๋ฒ” ์ •๋ณด ์ˆ˜์ • ์ž…๋ ฅ๊ฐ’์ด ์—†์„ ๊ฒฝ์šฐ alert ์ถœ๋ ฅ
Browse files Browse the repository at this point in the history
  • Loading branch information
krungy committed Dec 22, 2021
1 parent 84c6205 commit 5e26d8d
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions src/pages/AlbumSettingsEditPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,29 +90,33 @@ const AlbumSettingsEditPage = () => {
const { values, isLoading, handleChange, handleSubmit } = useForm({
initialValues: intialState,
onSubmit: async () => {
for (let value in albumInfo) {
if (value === 'id') continue;
if (
values[value] === '' ||
values[value] === 0 ||
value === 'thumbnail'
) {
values[value] = albumInfo[value];
if (image === '' && values.title === '' && values.familyMotto === '') {
alert('๋ณ€๊ฒฝํ•  ์•จ๋ฒ” ์ •๋ณด๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.');
} else {
for (let value in albumInfo) {
if (value === 'id') continue;
if (
values[value] === '' ||
values[value] === 0 ||
value === 'thumbnail'
) {
values[value] = albumInfo[value];
}
}
}

if (image !== '') {
const imageUrl = await postImageUploads(image);
values.thumbnail = imageUrl;
}
if (image !== '') {
const imageUrl = await postImageUploads(image);
values.thumbnail = imageUrl;
}

try {
const res = await putAlbumInfo(albumId, values);
res && alert('์„ฑ๊ณต์ ์œผ๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.');
goBack();
} catch ({ response }) {
const { data } = response;
console.log(data);
try {
const res = await putAlbumInfo(albumId, values);
res && alert('์„ฑ๊ณต์ ์œผ๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.');
goBack();
} catch ({ response }) {
const { data } = response;
console.log(data);
}
}
},
});
Expand Down

0 comments on commit 5e26d8d

Please # to comment.