Skip to content

Commit

Permalink
Improve Tobira error handling
Browse files Browse the repository at this point in the history
This will basically just reset any Tobira errors
when opening a new series details modal, and
remove any notifications when closing series modals.
  • Loading branch information
owi92 committed Dec 10, 2024
1 parent aaaaef7 commit d419aeb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/events/partials/modals/SeriesDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { useTranslation } from "react-i18next";
import SeriesDetails from "./SeriesDetails";
import { useHotkeys } from "react-hotkeys-hook";
import { availableHotkeys } from "../../../../configs/hotkeysConfig";
import { removeNotificationWizardForm } from "../../../../slices/notificationSlice";
import { useAppDispatch } from "../../../../store";

/**
* This component renders the modal for displaying series details
Expand All @@ -17,6 +19,7 @@ const SeriesDetailsModal = ({
seriesId: string
}) => {
const { t } = useTranslation();
const dispatch = useAppDispatch();

// tracks, whether the policies are different to the initial value
const [policyChanged, setPolicyChanged] = useState(false);
Expand All @@ -28,6 +31,7 @@ const SeriesDetailsModal = ({
const close = () => {
if (!policyChanged || confirmUnsaved()) {
setPolicyChanged(false);
dispatch(removeNotificationWizardForm());
handleClose();
}
};
Expand Down
1 change: 1 addition & 0 deletions src/slices/seriesDetailsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ const seriesDetailsSlice = createSlice({
.addCase(fetchSeriesDetailsTobira.fulfilled, (state, action: PayloadAction<
SeriesDetailsState["tobiraData"]
>) => {
state.errorTobiraData = null;
state.statusTobiraData = 'succeeded';
state.tobiraData = action.payload;
})
Expand Down

0 comments on commit d419aeb

Please sign in to comment.