import { createSlice, createAsyncThunk } from '@reduxjs/toolkit' import jquery from 'jquery' export const getStatusSPT = createAsyncThunk('peta/getStatusSPT', async () => { const response = await jquery.get(`/engineN/kewilayahan/ref/statusspt`) return response }) export const petaSlice = createSlice({ name: 'peta', initialState: { selectedOpsi: null, user: {}, warnaBayar: { black: { wb: 'black', info: 'di bawah Rp0', warna: '#202020' }, grey: { wb: 'grey', info: 'Rp0', warna: '#4f4b4d' }, red: { wb: 'red', info: 'di bawah 5juta', warna: '#ff0000' }, yellow: { wb: 'yellow', info: '5 jt s.d. 48 jt', warna: '#aba210' }, green: { wb: 'green', info: '48 jt s.d. 100 jt', warna: '#00a800' }, blue: { wb: 'blue', info: 'di atas 100 jt', warna: '#0000e1' } }, statusSPT: {}, cqlFilterWilayah: '(1=1)' }, reducers: { setSelectedOpsi: (state, action) => { state.selectedOpsi = action.payload }, setCqlFilterWilayah: (state, action) => { state.cqlFilterWilayah = action.payload } }, extraReducers: (builder) => { builder.addCase(getStatusSPT.fulfilled, (state, action) => { state.statusSPT = action.payload }) } }) export const { setSelectedOpsi, setDataMonitoring, setDataUrut, setCqlFilterWilayah } = petaSlice.actions export default petaSlice.reducer