catch promise

This commit is contained in:
2023-03-07 13:03:51 +10:00
parent b62a3b9d63
commit 57092e1b26
2 changed files with 33 additions and 25 deletions

View File

@@ -65,13 +65,17 @@ const mediaItems: Ref<Media[]> = ref([]);
* Handle the user adding a new media item.
*/
const handleClickAdd = async () => {
openDialog(SMDialogMedia, { mime: "", accepts: "" }).then((result) => {
openDialog(SMDialogMedia, { mime: "", accepts: "" })
.then((result) => {
const media = result as Media;
mediaItems.value.push(media);
value.value.push(media.id);
emits("update:modelValue", value);
})
.catch(() => {
/* empty */
});
};

View File

@@ -66,7 +66,8 @@ const waitForElementRender = (elem: Ref): Promise<HTMLElement> => {
* @returns {void}
*/
export const transitionEnter = (elem: Ref, transition: string): void => {
waitForElementRender(elem).then((e: HTMLElement) => {
waitForElementRender(elem)
.then((e: HTMLElement) => {
window.setTimeout(() => {
e.classList.replace(
transition + "-enter-from",
@@ -84,6 +85,9 @@ export const transitionEnter = (elem: Ref, transition: string): void => {
false
);
}, 1);
})
.catch(() => {
/* empty */
});
};