remove redux

This commit is contained in:
MathieuG-P
2022-05-22 22:51:51 +02:00
parent d30f3eff5d
commit f91a183f5e
5 changed files with 18 additions and 131 deletions
@@ -1,20 +0,0 @@
import { BSVersion } from "../../../main/services/bs-version-manager.service"
import { ReducerAction } from "../store"
const INITIAL_STATE = {
availableVersions: [] as BSVersion[]
}
function availableBsReducer(state = INITIAL_STATE, action: ReducerAction<BSVersion[]>){
switch(action.type){
case 'AVAILABLE_BS_INIT': {
if(!action.payload){ return state; }
const payload = action.payload as BSVersion[];
return { ...state, availableVersions: [...state.availableVersions, ...payload] };
}
}
return state;
}
export default availableBsReducer;
@@ -1,25 +0,0 @@
import { BSVersion } from "../../../main/services/bs-version-manager.service"
import { ReducerAction } from "../store"
const INITIAL_STATE = {
installedVersions: [] as BSVersion[]
}
function installedBSReducer(state = INITIAL_STATE, action: ReducerAction<BSVersion|BSVersion[]>){
switch(action.type){
case 'INSTALLED_BS_ADD_ALL': {
if(!action.payload){ return state; }
const payload = action.payload as BSVersion[];
return { ...state, installedVersions: [...state.installedVersions, ...payload] };
}
case 'INSTALLED_BS_ADD':{
if(!action.payload){ return state; }
const payload = action.payload as BSVersion;
return { ...state, installedVersions: [...state.installedVersions, payload]}
}
}
return state;
}
export default installedBSReducer;
-16
View File
@@ -1,16 +0,0 @@
import { configureStore } from "@reduxjs/toolkit";
import installedBSReducer from './reducers/bs-versions-installed.reducer'
import availableBsReducer from './reducers/bs-versions-available.reducer'
const store = configureStore({
reducer:{
installedBSReducer, availableBsReducer
}
});
export default store;
export interface ReducerAction<T> {
type: string,
payload?: T
}