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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 41x 2x 2x 2x 2x 4x 4x 2x 2x 2x | import { update as updateUserConnections } from "../cache/user-connection-intentions";
import type { UseContextedMutationOptions } from "../context";
import { updatePeerConnected } from "./utils";
export const options: UseContextedMutationOptions<"userConnectionIntentions.add"> =
{
mutationKey: "userConnectionIntentions.add",
onSuccess: (controllerContext) => (result, variables) => {
Iif (result.connected) {
updatePeerConnected(controllerContext, variables.peerId, result.user);
} else {
updateUserConnections(controllerContext, {
getAll: (controller) =>
controller.outbound.add({
user: {
id: result.user.id,
email: result.user.email,
},
peer: {
id: variables.peerId,
name: result.peer.name,
},
}),
});
}
},
mutateToastOptions:
({ t }) =>
(variablesSet) => ({
text: t("toasts.addIntention.mutate", {
ns: "peers",
intentionsAmount: variablesSet.length,
emails: variablesSet.map((variables) => `"${variables.email}"`),
}),
}),
successToastOptions:
({ t }) =>
(_result, variablesSet) => ({
text: t("toasts.addIntention.success", {
ns: "peers",
intentionsAmount: variablesSet.length,
emails: variablesSet.map((variables) => `"${variables.email}"`),
}),
}),
errorToastOptions:
({ t }) =>
(errors) => ({
text: t("toasts.addIntention.error", {
ns: "peers",
intentionsAmount: errors.length,
errors,
}),
}),
};
|