fix: handle undefined value in Promise.all for mediaIds

This commit is contained in:
sevichecc 2023-04-17 00:43:27 +08:00
parent 1ce94ec7de
commit af7cf9044d
Signed by untrusted user who does not match committer: SevicheCC
GPG key ID: C577000000000000

View file

@ -73,7 +73,7 @@ export default function SimpleCommand(props: CommandProps) {
value.files?.map(async (file) => { value.files?.map(async (file) => {
const { id } = await apiServer.uploadAttachment({ file, description: value.description }); const { id } = await apiServer.uploadAttachment({ file, description: value.description });
return id; return id;
}) }) ?? []
); );
const newStatus: Partial<StatusRequest> = { const newStatus: Partial<StatusRequest> = {
@ -96,7 +96,7 @@ export default function SimpleCommand(props: CommandProps) {
cw: "", cw: "",
})); }));
cache.set("latest_published_status", JSON.stringify(response)); cache.set("latest_published_status", JSON.stringify(response));
setTimeout(() => popToRoot, 2000); setTimeout(() => popToRoot(), 2000);
} catch (error) { } catch (error) {
const requestErr = error as AkkomaError; const requestErr = error as AkkomaError;
showToast(Toast.Style.Failure, "Error", requestErr.message); showToast(Toast.Style.Failure, "Error", requestErr.message);