production-taskbar-client / src / renderer / apis / cacheSlice.js
cacheSlice.js
Raw
import { createSlice } from "@reduxjs/toolkit";

export const cacheSlice = createSlice({
  name: "cache",
  initialState: {
    attachments: {},
  },
  reducers: {
    cacheDataUrl: (state, action) => {
      const { name, dataURL } = action.payload;
      state.attachments[name] = dataURL;
    },
  },
});

export const { cacheDataUrl } = cacheSlice.actions;

export default cacheSlice.reducer;