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 { FeatureType } from "@/stores/workspace";
|
||||
import { IdentityProvider } from "@/types/proto/api/v1/workspace_service";
|
||||
import { showCommonDialog } from "../Alert";
|
||||
import CreateIdentityProviderDrawer from "../CreateIdentityProviderDrawer";
|
||||
import FeatureBadge from "../FeatureBadge";
|
||||
import Icon from "../Icon";
|
||||
@ -33,8 +34,11 @@ const SSOSection = () => {
|
||||
};
|
||||
|
||||
const handleDeleteIdentityProvider = async (identityProvider: IdentityProvider) => {
|
||||
const confirmed = window.confirm(`Are you sure you want to delete ${identityProvider.title}?`);
|
||||
if (confirmed) {
|
||||
showCommonDialog({
|
||||
title: "Delete identity provider",
|
||||
content: `Are you sure to delete identity provider \`${identityProvider.title}\`? You cannot undo this action.`,
|
||||
style: "danger",
|
||||
onConfirm: async () => {
|
||||
try {
|
||||
await workspaceServiceClient.updateWorkspaceSetting({
|
||||
setting: {
|
||||
@ -47,7 +51,8 @@ const SSOSection = () => {
|
||||
toast.error(error.details);
|
||||
}
|
||||
await fetchIdentityProviderList();
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Alert, Button, Divider, Link, Textarea } from "@mui/joy";
|
||||
import { useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { showCommonDialog } from "@/components/Alert";
|
||||
import Icon from "@/components/Icon";
|
||||
import SubscriptionFAQ from "@/components/SubscriptionFAQ";
|
||||
import { subscriptionServiceClient } from "@/grpcweb";
|
||||
@ -22,8 +23,11 @@ const SubscriptionSetting: React.FC = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const confirmed = window.confirm("Are you sure you want to reset the license key?");
|
||||
if (confirmed) {
|
||||
showCommonDialog({
|
||||
title: "Reset licence key",
|
||||
content: `Are you sure to reset the license key? You cannot undo this action.`,
|
||||
style: "warning",
|
||||
onConfirm: async () => {
|
||||
try {
|
||||
await subscriptionServiceClient.deleteSubscription({});
|
||||
toast.success("License key has been reset");
|
||||
@ -31,7 +35,8 @@ const SubscriptionSetting: React.FC = () => {
|
||||
toast.error(error.details);
|
||||
}
|
||||
await workspaceStore.fetchWorkspaceProfile();
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const handleUpdateLicenseKey = async () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user