TP-48565 | added action types
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
import { JiraDashboardState } from '@src/types';
|
||||
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
||||
import { JiraDashboardState, JiraDashboardData, PageDetails } from '@src/types';
|
||||
|
||||
type SetJiraDashboardDataAction = PayloadAction<JiraDashboardData[]>;
|
||||
type SetPageDetailsAction = PayloadAction<PageDetails>;
|
||||
type SetIsLoadingAction = PayloadAction<boolean>;
|
||||
type SetCurrentPageNumberAction = PayloadAction<number>;
|
||||
type SetCurrentPageSizeAction = PayloadAction<number>;
|
||||
|
||||
const initialState: JiraDashboardState = {
|
||||
data: [],
|
||||
@@ -17,19 +23,19 @@ const jiraDashboardSlice = createSlice({
|
||||
name: 'jiraDashboard',
|
||||
initialState,
|
||||
reducers: {
|
||||
setJiraDashboardData: (state, action) => {
|
||||
setJiraDashboardData: (state, action: SetJiraDashboardDataAction) => {
|
||||
state.data = action.payload;
|
||||
},
|
||||
setPageDetails: (state, action) => {
|
||||
setPageDetails: (state, action: SetPageDetailsAction) => {
|
||||
state.pageDetails = action.payload;
|
||||
},
|
||||
setIsLoading: (state, action) => {
|
||||
setIsLoading: (state, action: SetIsLoadingAction) => {
|
||||
state.isLoading = action.payload;
|
||||
},
|
||||
setCurrentPageNumber: (state, action) => {
|
||||
setCurrentPageNumber: (state, action: SetCurrentPageNumberAction) => {
|
||||
state.currentPageNumber = action.payload;
|
||||
},
|
||||
setCurrentPageSize: (state, action) => {
|
||||
setCurrentPageSize: (state, action: SetCurrentPageSizeAction) => {
|
||||
state.currentPageSize = action.payload;
|
||||
},
|
||||
},
|
||||
|
||||
6
src/types/index.d.ts
vendored
6
src/types/index.d.ts
vendored
@@ -47,3 +47,9 @@ export interface JiraDashboardState {
|
||||
currentPageNumber: number;
|
||||
currentPageSize: number;
|
||||
}
|
||||
|
||||
export interface PageDetails {
|
||||
pageNumber: number;
|
||||
pageSize: number;
|
||||
totalElements: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user