Try re-post if idempotency key fails

This commit is contained in:
Lim Chee Aun 2023-05-23 19:16:24 +08:00
parent 17334de24a
commit efa4ba63eb

View file

@ -816,9 +816,14 @@ function Compose({
skipThreading: true,
});
} else {
newStatus = await masto.v1.statuses.create(params, {
idempotencyKey: UID.current,
});
try {
newStatus = await masto.v1.statuses.create(params, {
idempotencyKey: UID.current,
});
} catch (_) {
// If idempotency key fails, try again without it
newStatus = await masto.v1.statuses.create(params);
}
}
setUIState('default');