refactor this code import { createSlice, Slice } from '@reduxjs/toolkit';
import { NonProfit } from '../types/NonProfits';

export type NonProfitState = {
  nprofits: NonProfit[];
  eligible_nprofits: NonProfit[];
};

const NonProfits: Slice = createSlice({
  name: 'nonprofits',
  initialState: {
    nprofits: [],
    eligible_nprofits: [],
  } as NonProfitState,
  reducers: {
    setNonProfits: (state, { payload: { nprofits } }) => ({
      ...state,
      ...{ nprofits },
    }),
    setEligibleNonProfits: (state, { payload: { eligible_nprofits } }) => ({
      ...state,
      ...{ eligible_nprofits },
    }),
  },
});

export const { setNonProfits, setEligibleNonProfits } = NonProfits.actions;
export default NonProfits.reducer;
 Provide the entire answer in JSON format.
user