Merge remote-tracking branch 'origin/main' into finish-pure-status-component
This commit is contained in:
commit
1e07105016
|
@ -384,7 +384,10 @@ const uploadCompose = (composeId: string, files: FileList, intl: IntlShape) =>
|
||||||
f,
|
f,
|
||||||
intl,
|
intl,
|
||||||
(data) => dispatch(uploadComposeSuccess(composeId, data, f)),
|
(data) => dispatch(uploadComposeSuccess(composeId, data, f)),
|
||||||
(error) => dispatch(uploadComposeFail(composeId, error)),
|
(error) => {
|
||||||
|
console.error(error);
|
||||||
|
dispatch(uploadComposeFail(composeId, error));
|
||||||
|
},
|
||||||
(e: ProgressEvent) => {
|
(e: ProgressEvent) => {
|
||||||
progress[i] = e.loaded;
|
progress[i] = e.loaded;
|
||||||
dispatch(uploadComposeProgress(composeId, progress.reduce((a, v) => a + v, 0), e.total));
|
dispatch(uploadComposeProgress(composeId, progress.reduce((a, v) => a + v, 0), e.total));
|
||||||
|
|
|
@ -81,7 +81,7 @@ export class MastodonResponse extends Response {
|
||||||
z.string(),
|
z.string(),
|
||||||
z.object({ error: z.string(), description: z.string() }).array(),
|
z.object({ error: z.string(), description: z.string() }).array(),
|
||||||
).optional(),
|
).optional(),
|
||||||
});
|
}).passthrough();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'soapbox/polyfill/Promise.withResolvers.ts';
|
||||||
|
|
||||||
import { enableMapSet } from 'immer';
|
import { enableMapSet } from 'immer';
|
||||||
import { createRoot } from 'react-dom/client';
|
import { createRoot } from 'react-dom/client';
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
if (!Promise.withResolvers) {
|
||||||
|
Promise.withResolvers = function withResolvers<T>(): PromiseWithResolvers<T> {
|
||||||
|
|
||||||
|
let resolve: (value: T | PromiseLike<T>) => void;
|
||||||
|
let reject: (reason?: any) => void;
|
||||||
|
|
||||||
|
const promise = new this<T>((_resolve, _reject) => {
|
||||||
|
resolve = _resolve;
|
||||||
|
reject = _reject;
|
||||||
|
});
|
||||||
|
|
||||||
|
return { resolve: resolve!, reject: reject!, promise };
|
||||||
|
};
|
||||||
|
}
|
|
@ -57,9 +57,13 @@ async function showAlertForError(networkError: HTTPError): Promise<void> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await response.error();
|
try {
|
||||||
if (data) {
|
const data = await response.error();
|
||||||
return error(data.error);
|
if (data) {
|
||||||
|
return error(data.error);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// fallthrough
|
||||||
}
|
}
|
||||||
|
|
||||||
const message = httpErrorMessages.find((httpError) => httpError.code === status)?.description;
|
const message = httpErrorMessages.find((httpError) => httpError.code === status)?.description;
|
||||||
|
|
Loading…
Reference in New Issue