mirror of
https://github.com/usebruno/bruno.git
synced 2025-05-05 15:32:58 +00:00
46 lines
1013 B
JavaScript
46 lines
1013 B
JavaScript
import { createSlice } from '@reduxjs/toolkit';
|
|
|
|
const initialState = {
|
|
isDragging: false,
|
|
idbConnectionReady: false,
|
|
leftSidebarWidth: 222,
|
|
screenWidth: 500,
|
|
showHomePage: false
|
|
};
|
|
|
|
export const appSlice = createSlice({
|
|
name: 'app',
|
|
initialState,
|
|
reducers: {
|
|
idbConnectionReady: (state) => {
|
|
state.idbConnectionReady = true;
|
|
},
|
|
refreshScreenWidth: (state) => {
|
|
state.screenWidth = window.innerWidth;
|
|
},
|
|
updateLeftSidebarWidth: (state, action) => {
|
|
state.leftSidebarWidth = action.payload.leftSidebarWidth;
|
|
},
|
|
updateIsDragging: (state, action) => {
|
|
state.isDragging = action.payload.isDragging;
|
|
},
|
|
showHomePage: (state) => {
|
|
state.showHomePage = true;
|
|
},
|
|
hideHomePage: (state) => {
|
|
state.showHomePage = false;
|
|
}
|
|
}
|
|
});
|
|
|
|
export const {
|
|
idbConnectionReady,
|
|
refreshScreenWidth,
|
|
updateLeftSidebarWidth,
|
|
updateIsDragging,
|
|
showHomePage,
|
|
hideHomePage
|
|
} = appSlice.actions;
|
|
|
|
export default appSlice.reducer;
|