import { createSlice, PayloadAction } from "@reduxjs/toolkit";

interface UIState {
    isLoading: boolean;
    hideNavbar: boolean;
}

const initialState: UIState = {
    isLoading: false,
    hideNavbar: false,
};

const uiSlice = createSlice({
    name: "ui",
    initialState,
    reducers: {
        setIsLoading: (state, action: PayloadAction<boolean>) => {
            state.isLoading = action.payload;
        },
        setHideNavbar: (state, action: PayloadAction<boolean>) => {
            state.hideNavbar = action.payload;
        },
    },
});

export default uiSlice.reducer;
export const { setIsLoading, setHideNavbar} = uiSlice.actions;
