-
Notifications
You must be signed in to change notification settings - Fork 38
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
Conversation
Add a resize button that opens a modal and let the user change both the width and height of the image
ui/src/actions/handleResizeImage.ts
Outdated
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); | ||
}) | ||
} |
There was a problem hiding this comment.
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
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 }); | |
}) | |
} |
fixed in commit 04c9f3d |
@kevinanielsen LGTM, what do you think? Can we merge? |
Yeah, looks good - Nice job on this :) |
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