mirror of
https://github.com/outline/outline.git
synced 2026-12-03 01:59:03 +03:00
* chore: Audit and move inline actions to definitions * fix: Reuse existing smart-quote translation key in emoji delete dialog Co-Authored-By: Claude <noreply@anthropic.com> * Remove two usages of 'Link copied' translation --------- Co-authored-by: Claude <noreply@anthropic.com>
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import { useTranslation } from "react-i18next";
|
|
import { useHistory, useLocation } from "react-router-dom";
|
|
import type OAuthClient from "~/models/oauth/OAuthClient";
|
|
import ConfirmationDialog from "~/components/ConfirmationDialog";
|
|
import { settingsPath } from "~/utils/routeHelpers";
|
|
|
|
type Props = {
|
|
oauthClient: OAuthClient;
|
|
onSubmit: () => void;
|
|
};
|
|
|
|
export default function OAuthClientDeleteDialog({
|
|
oauthClient,
|
|
onSubmit,
|
|
}: Props) {
|
|
const { t } = useTranslation();
|
|
const history = useHistory();
|
|
const location = useLocation();
|
|
|
|
const handleSubmit = async () => {
|
|
// Navigate back to the list if we're viewing the app being deleted.
|
|
if (location.pathname === settingsPath("applications", oauthClient.id)) {
|
|
history.push(settingsPath("applications"));
|
|
}
|
|
|
|
await oauthClient.delete();
|
|
onSubmit();
|
|
};
|
|
|
|
return (
|
|
<ConfirmationDialog
|
|
onSubmit={handleSubmit}
|
|
submitText={t("Delete")}
|
|
savingText={`${t("Deleting")}…`}
|
|
danger
|
|
>
|
|
{t(
|
|
"Are you sure you want to delete the {{ appName }} application? This cannot be undone.",
|
|
{
|
|
appName: oauthClient.name,
|
|
}
|
|
)}
|
|
</ConfirmationDialog>
|
|
);
|
|
}
|