mirror of
https://github.com/house-of-vanity/OutFleet.git
synced 2025-10-24 01:09:08 +00:00
33 lines
802 B
TypeScript
33 lines
802 B
TypeScript
import { createSlice } from '@reduxjs/toolkit';
|
|
import type { PayloadAction } from '@reduxjs/toolkit';
|
|
import type { CertificateDTO } from './dto';
|
|
|
|
export interface CertificatesState {
|
|
loading: boolean;
|
|
certificates: CertificateDTO[]
|
|
error: null | string;
|
|
}
|
|
|
|
const initialState: CertificatesState = {
|
|
loading: false,
|
|
certificates: [],
|
|
error: null,
|
|
};
|
|
|
|
export const certificateSlice = createSlice({
|
|
name: 'certificates',
|
|
initialState,
|
|
reducers: {
|
|
setLoading: (state, action: PayloadAction<boolean>) => {
|
|
state.loading = action.payload
|
|
},
|
|
setUsers: (state, action: PayloadAction<CertificateDTO[]>) => {
|
|
state.certificates = action.payload
|
|
},
|
|
setError: (state, action: PayloadAction<string>) => {
|
|
state.error = action.payload
|
|
}
|
|
},
|
|
});
|
|
|