import { createSlice } from "@reduxjs/toolkit";

export const theSlice = createSlice({
  name: 'common-settings',
  initialState: {
    data: {},
    loaded: false,
  },
  reducers: {
    // section parts
    loadCommonSettings: (state, action) => {
      const data = action.payload;
      state.data = data;
      state.loaded = true;
    },
    updateCommonSetting: (state, action) => {
      const data = action.payload
      Object.assign(state.data, data);
    }
  }
});

export const {
  loadCommonSettings,
  updateCommonSetting,
} = theSlice.actions;
export default theSlice.reducer;