-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { PayloadAction, createSlice } from '@reduxjs/toolkit'; | ||
import { Series, SeriesMainDicomTags, Study, StudyMainDicomTags } from '../utils/types'; | ||
|
||
export interface DeleteState { | ||
series: { | ||
[seriesId: string]: { | ||
studyId: string, | ||
seriesId: string, | ||
studyMainDicomTags: StudyMainDicomTags, | ||
seriesMainDicomTags: SeriesMainDicomTags | ||
} | ||
} | ||
} | ||
|
||
type DeletePayload = { | ||
study: Study, | ||
series: Series | ||
} | ||
|
||
type RemovePayload = { | ||
seriesId: string | ||
} | ||
|
||
const initialState: DeleteState = { | ||
series: {}, | ||
} | ||
|
||
const deleteSlice = createSlice({ | ||
name: 'delete', | ||
initialState, | ||
reducers: { | ||
addSeriesToDeleteList: (state, action: PayloadAction<DeletePayload>) => { | ||
const study = action.payload.study; | ||
const series = action.payload.series; | ||
|
||
state.series[series.id] = { | ||
studyId: study.id, | ||
seriesId: series.id, | ||
studyMainDicomTags: study.mainDicomTags, | ||
seriesMainDicomTags: series.mainDicomTags | ||
} | ||
|
||
}, | ||
removeSeriesFromDeleteList: (state, action: PayloadAction<RemovePayload>) => { | ||
const seriesId = action.payload.seriesId; | ||
delete state.series?.[seriesId] | ||
} | ||
} | ||
}) | ||
export const { addSeriesToDeleteList, removeSeriesFromDeleteList } = deleteSlice.actions; | ||
export default deleteSlice.reducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters