feat: Throwing a toast when adding a new team member (#8046)
Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
This commit is contained in:
1 parent
c052c66abc
commit
352a467104
5 files changed
+32
-5
No files matched your search
@@ -1692,5 +1692,6 @@
|
||||
"subtitle_analytics": "Learn more about your team's activity",
|
||||
"event_trends": "Event Trends",
|
||||
"clear_filters": "Clear Filters",
|
||||
"insights": "Insights"
|
||||
"insights": "Insights",
|
||||
"email_invite_team": "{{email}} has been invited"
|
||||
}
|
||||
@@ -7,7 +7,8 @@ import MemberInvitationModal from "@calcom/features/ee/teams/components/MemberIn
|
||||
import { classNames } from "@calcom/lib";
|
||||
import { WEBAPP_URL, APP_NAME } from "@calcom/lib/constants";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { RouterOutputs, trpc } from "@calcom/trpc/react";
|
||||
import type { RouterOutputs } from "@calcom/trpc/react";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Avatar, Badge, Button, showToast, SkeletonContainer, SkeletonText } from "@calcom/ui";
|
||||
import { FiPlus, FiArrowRight, FiTrash2 } from "@calcom/ui/components/icon";
|
||||
|
||||
@@ -43,9 +44,17 @@ export const AddNewTeamMembersForm = ({
|
||||
const utils = trpc.useContext();
|
||||
const router = useRouter();
|
||||
const inviteMemberMutation = trpc.viewer.teams.inviteMember.useMutation({
|
||||
async onSuccess() {
|
||||
async onSuccess(data) {
|
||||
await utils.viewer.teams.get.invalidate();
|
||||
setMemberInviteModal(false);
|
||||
if (data.sendEmailInvitation) {
|
||||
showToast(
|
||||
t("email_invite_team", {
|
||||
email: data.usernameOrEmail,
|
||||
}),
|
||||
"success"
|
||||
);
|
||||
}
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
|
||||
@@ -56,9 +56,17 @@ export default function TeamListItem(props: Props) {
|
||||
const [openMemberInvitationModal, setOpenMemberInvitationModal] = useState(false);
|
||||
const teamQuery = trpc.viewer.teams.get.useQuery({ teamId: team?.id });
|
||||
const inviteMemberMutation = trpc.viewer.teams.inviteMember.useMutation({
|
||||
async onSuccess() {
|
||||
async onSuccess(data) {
|
||||
await utils.viewer.teams.get.invalidate();
|
||||
setOpenMemberInvitationModal(false);
|
||||
if (data.sendEmailInvitation) {
|
||||
showToast(
|
||||
t("email_invite_team", {
|
||||
email: data.usernameOrEmail,
|
||||
}),
|
||||
"success"
|
||||
);
|
||||
}
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
|
||||
@@ -32,9 +32,17 @@ const MembersView = () => {
|
||||
);
|
||||
|
||||
const inviteMemberMutation = trpc.viewer.teams.inviteMember.useMutation({
|
||||
async onSuccess() {
|
||||
async onSuccess(data) {
|
||||
await utils.viewer.teams.get.invalidate();
|
||||
setShowMemberInvitationModal(false);
|
||||
if (data.sendEmailInvitation) {
|
||||
showToast(
|
||||
t("email_invite_team", {
|
||||
email: data.usernameOrEmail,
|
||||
}),
|
||||
"success"
|
||||
);
|
||||
}
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
|
||||
@@ -386,6 +386,7 @@ export const viewerTeamsRouter = router({
|
||||
}
|
||||
}
|
||||
if (IS_TEAM_BILLING_ENABLED) await updateQuantitySubscriptionFromStripe(input.teamId);
|
||||
return input;
|
||||
}),
|
||||
acceptOrLeave: authedProcedure
|
||||
.input(
|
||||
|
||||
Reference in new issue
Block a user