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

feat(ui): Add a resize button to the image content card #142

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

luckramos
Copy link
Contributor

@luckramos luckramos commented Aug 30, 2024

Add a resize button that opens a modal and let the user change both the width and height of the image

This PR references the issue #90

Add a resize button that opens a modal and let the user change both the width and height of the image
Comment on lines 22 to 36
toast.loading("Renaming file...");
axios.put(`/api/cdn/resize/image`, JSON.stringify(data)).then((res) => {
if (res.status === 200) {
toast.dismiss();
toast.success("File resized!");

setTimeout(() => {
location.reload();
}, 1500)
}
}).catch((err) => {
toast.dismiss();
toast.error("Error: " + err.response.data);
})
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toast.loading returns an id, you can take this id and pass it to success and error so you don't need to use toast.dismiss

Suggested change
toast.loading("Renaming file...");
axios.put(`/api/cdn/resize/image`, JSON.stringify(data)).then((res) => {
if (res.status === 200) {
toast.dismiss();
toast.success("File resized!");
setTimeout(() => {
location.reload();
}, 1500)
}
}).catch((err) => {
toast.dismiss();
toast.error("Error: " + err.response.data);
})
}
const toastId = toast.loading("Renaming file...");
axios.put(`/api/cdn/resize/image`, JSON.stringify(data)).then((res) => {
if (res.status === 200) {
toast.success("File resized!", { id: toastId, duration: 4000 });
setTimeout(() => {
location.reload();
}, 1500)
}
}).catch((err) => {
toast.error("Error: " + err.response.data, { id: toastId, duration: 4000 });
})
}

@luckramos
Copy link
Contributor Author

fixed in commit 04c9f3d

@Caixetadev
Copy link
Collaborator

@kevinanielsen LGTM, what do you think? Can we merge?

@kevinanielsen
Copy link
Owner

@kevinanielsen LGTM, what do you think? Can we merge?

Yeah, looks good - Nice job on this :)

@kevinanielsen kevinanielsen merged commit f69a174 into kevinanielsen:main Sep 9, 2024
2 checks passed
@kevinanielsen kevinanielsen linked an issue Sep 9, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Add button for resizing images
3 participants