// /redux/slices/polylineLayerVisibleSlice.js
// redux/slices/polylineLayerVisibleSlice.js
import { createSlice } from "@reduxjs/toolkit";

const initialState = {
  visible: false, // oder Standardwert
};

const polylineLayerVisibleSlice = createSlice({
  name: "polylineLayerVisible",
  initialState,
  reducers: {
    setPolylineVisible: (state, action) => {
      state.visible = action.payload;
      localStorage.setItem("polylineVisible", action.payload);
    },
  },
});

export const { setPolylineVisible } = polylineLayerVisibleSlice.actions;
export const selectPolylineVisible = (state) => state.polylineLayerVisible.visible;
export default polylineLayerVisibleSlice.reducer;
