mirror of
https://github.com/aykhans/slash-e.git
synced 2025-04-16 04:13:12 +00:00
chore: update confirm dialogs
This commit is contained in:
parent
200242aa67
commit
d97cbbb183
@ -6,6 +6,7 @@ import { workspaceServiceClient } from "@/grpcweb";
|
|||||||
import { useWorkspaceStore } from "@/stores";
|
import { useWorkspaceStore } from "@/stores";
|
||||||
import { FeatureType } from "@/stores/workspace";
|
import { FeatureType } from "@/stores/workspace";
|
||||||
import { IdentityProvider } from "@/types/proto/api/v1/workspace_service";
|
import { IdentityProvider } from "@/types/proto/api/v1/workspace_service";
|
||||||
|
import { showCommonDialog } from "../Alert";
|
||||||
import CreateIdentityProviderDrawer from "../CreateIdentityProviderDrawer";
|
import CreateIdentityProviderDrawer from "../CreateIdentityProviderDrawer";
|
||||||
import FeatureBadge from "../FeatureBadge";
|
import FeatureBadge from "../FeatureBadge";
|
||||||
import Icon from "../Icon";
|
import Icon from "../Icon";
|
||||||
@ -33,21 +34,25 @@ const SSOSection = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteIdentityProvider = async (identityProvider: IdentityProvider) => {
|
const handleDeleteIdentityProvider = async (identityProvider: IdentityProvider) => {
|
||||||
const confirmed = window.confirm(`Are you sure you want to delete ${identityProvider.title}?`);
|
showCommonDialog({
|
||||||
if (confirmed) {
|
title: "Delete identity provider",
|
||||||
try {
|
content: `Are you sure to delete identity provider \`${identityProvider.title}\`? You cannot undo this action.`,
|
||||||
await workspaceServiceClient.updateWorkspaceSetting({
|
style: "danger",
|
||||||
setting: {
|
onConfirm: async () => {
|
||||||
identityProviders: identityProviderList.filter((idp) => idp.id !== identityProvider.id),
|
try {
|
||||||
},
|
await workspaceServiceClient.updateWorkspaceSetting({
|
||||||
updateMask: ["identity_providers"],
|
setting: {
|
||||||
});
|
identityProviders: identityProviderList.filter((idp) => idp.id !== identityProvider.id),
|
||||||
} catch (error: any) {
|
},
|
||||||
console.error(error);
|
updateMask: ["identity_providers"],
|
||||||
toast.error(error.details);
|
});
|
||||||
}
|
} catch (error: any) {
|
||||||
await fetchIdentityProviderList();
|
console.error(error);
|
||||||
}
|
toast.error(error.details);
|
||||||
|
}
|
||||||
|
await fetchIdentityProviderList();
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Alert, Button, Divider, Link, Textarea } from "@mui/joy";
|
import { Alert, Button, Divider, Link, Textarea } from "@mui/joy";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
|
import { showCommonDialog } from "@/components/Alert";
|
||||||
import Icon from "@/components/Icon";
|
import Icon from "@/components/Icon";
|
||||||
import SubscriptionFAQ from "@/components/SubscriptionFAQ";
|
import SubscriptionFAQ from "@/components/SubscriptionFAQ";
|
||||||
import { subscriptionServiceClient } from "@/grpcweb";
|
import { subscriptionServiceClient } from "@/grpcweb";
|
||||||
@ -22,16 +23,20 @@ const SubscriptionSetting: React.FC = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const confirmed = window.confirm("Are you sure you want to reset the license key?");
|
showCommonDialog({
|
||||||
if (confirmed) {
|
title: "Reset licence key",
|
||||||
try {
|
content: `Are you sure to reset the license key? You cannot undo this action.`,
|
||||||
await subscriptionServiceClient.deleteSubscription({});
|
style: "warning",
|
||||||
toast.success("License key has been reset");
|
onConfirm: async () => {
|
||||||
} catch (error: any) {
|
try {
|
||||||
toast.error(error.details);
|
await subscriptionServiceClient.deleteSubscription({});
|
||||||
}
|
toast.success("License key has been reset");
|
||||||
await workspaceStore.fetchWorkspaceProfile();
|
} catch (error: any) {
|
||||||
}
|
toast.error(error.details);
|
||||||
|
}
|
||||||
|
await workspaceStore.fetchWorkspaceProfile();
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUpdateLicenseKey = async () => {
|
const handleUpdateLicenseKey = async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user