Skip to content

Commit

Permalink
fix(prefs): Adding/editing API key no longer shows "Deleted" message …
Browse files Browse the repository at this point in the history
…MAASENG-2812 (#5334)
  • Loading branch information
ndv99 committed Mar 11, 2024
1 parent fe11629 commit 38fc68e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useDispatch, useSelector } from "react-redux";
import { useNavigate } from "react-router-dom-v5-compat";

import ModelActionForm from "@/app/base/components/ModelActionForm";
import { useAddMessage } from "@/app/base/hooks";
import urls from "@/app/base/urls";
import { actions as tokenActions } from "@/app/store/token";
import tokenSelectors from "@/app/store/token/selectors";
Expand All @@ -12,6 +13,8 @@ const APIKeyDeleteForm = ({ id }: { id: number }) => {
const saved = useSelector(tokenSelectors.saved);
const saving = useSelector(tokenSelectors.saving);

useAddMessage(saved, tokenActions.cleanup, "API key deleted successfully.");

return (
<ModelActionForm
aria-label="Delete API Key"
Expand Down
9 changes: 1 addition & 8 deletions src/app/preferences/views/APIKeys/APIKeyList/APIKeyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import { Notification } from "@canonical/react-components";
import { useSelector } from "react-redux";

import TableActions from "@/app/base/components/TableActions";
import {
useFetchActions,
useAddMessage,
useWindowTitle,
} from "@/app/base/hooks";
import { useFetchActions, useWindowTitle } from "@/app/base/hooks";
import urls from "@/app/base/urls";
import SettingsTable from "@/app/settings/components/SettingsTable";
import { actions as tokenActions } from "@/app/store/token";
Expand Down Expand Up @@ -54,9 +50,6 @@ const APIKeyList = (): JSX.Element => {
const loading = useSelector(tokenSelectors.loading);
const loaded = useSelector(tokenSelectors.loaded);
const tokens = useSelector(tokenSelectors.all);
const saved = useSelector(tokenSelectors.saved);

useAddMessage(saved, tokenActions.cleanup, "API key deleted successfully.");

useFetchActions([tokenActions.fetch]);

Expand Down

0 comments on commit 38fc68e

Please sign in to comment.