NeoScan_Physician/app/modules/Auth/redux/hospitalSlice.ts

55 lines
1.1 KiB
TypeScript

/*
* File: authSlice.ts
* Description: Redux slice for Auth state management
* Design & Developed by Tech4Biz Solutions
* Copyright (c) Spurrin Innovations. All rights reserved.
*/
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
interface Hospital {
hospital_id: string | null;
hospital_name: string | null;
}
// Auth state type
interface HospitalState {
hospitals: Hospital[] | null;
loading: boolean;
error: string | null;
}
const initialState: HospitalState = {
hospitals: [],
loading: false,
error: null,
};
/**
* Auth slice for managing authentication state
*/
const hospitalSlice = createSlice({
name: 'hospital',
initialState,
reducers: {
setHospitals(state, action: PayloadAction<Hospital[]>) {
state.hospitals = action.payload;
state.loading = false;
},
},
});
export const {
setHospitals
} = hospitalSlice.actions;
export default hospitalSlice.reducer;
/*
* End of File: authSlice.ts
* Design & Developed by Tech4Biz Solutions
* Copyright (c) Spurrin Innovations. All rights reserved.
*/