20 lines
410 B
JavaScript
20 lines
410 B
JavaScript
import { createSlice } from "@reduxjs/toolkit";
|
|
|
|
const loadingSlice = createSlice({
|
|
name: "loading",
|
|
initialState: {
|
|
isLoading: false,
|
|
},
|
|
reducers: {
|
|
showLoading: (state) => {
|
|
state.isLoading = true;
|
|
},
|
|
hideLoading: (state) => {
|
|
state.isLoading = false;
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { showLoading, hideLoading } = loadingSlice.actions;
|
|
export default loadingSlice.reducer;
|