mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
remove redux
This commit is contained in:
@@ -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;
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user