react-garden
Version:
React + TypeScript + ThreeJS app using Material UI on NextJS, Apollo Client, GraphQL + WordPress REST APIs, for ThreeD web development.. a part of the threed.ai code family.
36 lines (30 loc) • 848 B
JavaScript
// ** Redux Imports
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'
// ** Axios Imports
import axios from 'axios'
// ** Fetch Invoices
export const fetchData = createAsyncThunk('appPermissions/fetchData', async params => {
const response = await axios.get('/apps/permissions/data', {
params
})
return response.data
})
export const appPermissionsSlice = createSlice({
name: 'appPermissions',
initialState: {
data: [],
total: 1,
params: {},
allData: []
},
reducers: {},
extraReducers: builder => {
builder.addCase(fetchData.fulfilled, (state, action) => {
state.data = action.payload.permissions
state.params = action.payload.params
state.allData = action.payload.allData
state.total = action.payload.total
})
}
})
export default appPermissionsSlice.reducer