fix: add toast and fix delete action (#5912)

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
pull/5911/head^2
Udit Takkar 2022-12-07 20:07:20 +05:30 committed by GitHub
parent 190db1a0f6
commit cc9b49131e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import {
SkeletonButton, SkeletonButton,
SkeletonContainer, SkeletonContainer,
SkeletonText, SkeletonText,
showToast,
} from "@calcom/ui"; } from "@calcom/ui";
import { QueryCell } from "@lib/QueryCell"; import { QueryCell } from "@lib/QueryCell";
@ -66,6 +67,12 @@ const CalendarsView = () => {
async onSettled() { async onSettled() {
await utils.viewer.connectedCalendars.invalidate(); await utils.viewer.connectedCalendars.invalidate();
}, },
onSuccess: async () => {
showToast(t("calendar_updated_successfully"), "success");
},
onError: () => {
showToast(t("unexpected_error_try_again"), "error");
},
}); });
return ( return (

View File

@ -747,6 +747,7 @@
"toggle_calendars_conflict": "Toggle the calendars you want to check for conflicts to prevent double bookings.", "toggle_calendars_conflict": "Toggle the calendars you want to check for conflicts to prevent double bookings.",
"select_destination_calendar": "Create events on", "select_destination_calendar": "Create events on",
"connect_additional_calendar": "Connect additional calendar", "connect_additional_calendar": "Connect additional calendar",
"calendar_updated_successfully":"Calendar updated successfully",
"conferencing": "Conferencing", "conferencing": "Conferencing",
"calendar": "Calendar", "calendar": "Calendar",
"payments": "Payments", "payments": "Payments",

View File

@ -31,6 +31,7 @@ export default function DisconnectIntegration({
}) { }) {
const { t } = useLocale(); const { t } = useLocale();
const [modalOpen, setModalOpen] = useState(false); const [modalOpen, setModalOpen] = useState(false);
const utils = trpc.useContext();
const mutation = trpc.viewer.deleteCredential.useMutation({ const mutation = trpc.viewer.deleteCredential.useMutation({
onSuccess: () => { onSuccess: () => {
@ -42,6 +43,9 @@ export default function DisconnectIntegration({
showToast(t("error_removing_app"), "error"); showToast(t("error_removing_app"), "error");
setModalOpen(false); setModalOpen(false);
}, },
async onSettled() {
await utils.viewer.connectedCalendars.invalidate();
},
}); });
return ( return (