RegularToot: refactor, add env context
This commit is contained in:
parent
cbdf5e667d
commit
ad7db8e865
5 changed files with 164 additions and 123 deletions
|
@ -26,7 +26,13 @@ export type TootPollDialogPoll = {
|
|||
initialVotes?: readonly number[];
|
||||
multiple?: boolean;
|
||||
|
||||
onVote(votes: readonly number[]): void | Promise<void>;
|
||||
onVote: [
|
||||
(
|
||||
status: mastodon.v1.Status,
|
||||
votes: readonly number[],
|
||||
) => void | Promise<void>,
|
||||
mastodon.v1.Status,
|
||||
];
|
||||
onClose?: BottomSheetProps["onClose"] &
|
||||
((reason: "cancel" | "success") => void);
|
||||
};
|
||||
|
@ -50,7 +56,7 @@ const TootPollDialog: Component<TootPollDialogPoll> = (props) => {
|
|||
const sendVote = async () => {
|
||||
setInProgress(true);
|
||||
try {
|
||||
await props.onVote(votes());
|
||||
await props.onVote[0](props.onVote[1], votes());
|
||||
} catch (reason) {
|
||||
console.error(reason);
|
||||
props.onClose?.("cancel");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue