Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 78x 1x 1x 1x 1x 1x | import { update as updateReceipts } from "../cache/receipts";
import type { UseContextedMutationOptions } from "../context";
export const options: UseContextedMutationOptions<"receiptParticipants.add"> = {
mutationKey: "receiptParticipants.add",
onSuccess: (controllerContext) => (result, variables) => {
updateReceipts(controllerContext, {
get: (controller) => {
const selfPeerId = controller.getData(variables.receiptId)?.selfPeerId;
controller.addParticipant(variables.receiptId, {
peerId: variables.peerId,
role: variables.peerId === selfPeerId ? "owner" : variables.role,
createdAt: result.createdAt,
});
},
getPaged: undefined,
});
},
errorToastOptions:
({ t }) =>
(errors) => ({
text: t("toasts.addParticipant.error", {
ns: "receipts",
participantsCount: errors.length,
errors,
}),
}),
};
|