import { State } from '@egjs/react-flicking';
import { createSlice } from '@reduxjs/toolkit';

type LoadingState = {
  isLoading: boolean;
}

const loadingState: LoadingState = {
  isLoading: false,
};

export const slice = createSlice({
  name: 'networkLoading',
  initialState: loadingState,
  reducers: {
    toggleLoadingState(state) {
      state.isLoading = !state.isLoading;
    }
  },
});

export const { toggleLoadingState } = slice.actions;

const networkLoadingReducer = slice.reducer;
export default networkLoadingReducer;
