forked from 77media/video-flow
30 lines
741 B
TypeScript
30 lines
741 B
TypeScript
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
|
|
interface CreationTemplateState {
|
|
/** The selected template id to be applied by the creation form */
|
|
selectedTemplateId: string | null;
|
|
}
|
|
|
|
const initialState: CreationTemplateState = {
|
|
selectedTemplateId: null,
|
|
};
|
|
|
|
export const creationTemplateSlice = createSlice({
|
|
name: 'creationTemplate',
|
|
initialState,
|
|
reducers: {
|
|
selectTemplateById: (state, action: PayloadAction<string>) => {
|
|
state.selectedTemplateId = action.payload;
|
|
},
|
|
clearSelection: (state) => {
|
|
state.selectedTemplateId = null;
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { selectTemplateById, clearSelection } = creationTemplateSlice.actions;
|
|
|
|
export default creationTemplateSlice.reducer;
|
|
|
|
|