cleaned up store
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
const defaultState = {
|
||||
showAddOptions: false,
|
||||
showAddOption2: false
|
||||
}
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
case "SHOW_ADD_OPTIONS":
|
||||
|
||||
return {
|
||||
...state,
|
||||
showAddOptions: action.show
|
||||
}
|
||||
|
||||
case "SHOW_ADD_OPTIONS2":
|
||||
|
||||
return {
|
||||
...state,
|
||||
showAddOptions2: action.show
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
export default (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
|
||||
case "LOGIN":
|
||||
return {
|
||||
id: action.id,
|
||||
user: action.user
|
||||
}
|
||||
case "LOGOUT":
|
||||
return {}
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
export default (state = [], action) => {
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
case "SET_FILES":
|
||||
return action.files
|
||||
|
||||
case "ADD_FILE":
|
||||
|
||||
return [
|
||||
action.file,
|
||||
...state
|
||||
]
|
||||
|
||||
case "LOAD_MORE_FILES":
|
||||
|
||||
return [
|
||||
...state,
|
||||
...action.files
|
||||
]
|
||||
|
||||
case "EDIT_FILE":
|
||||
|
||||
return state.map((file) => {
|
||||
|
||||
if (file._id === action.id) {
|
||||
|
||||
return {...file, ...action.file}
|
||||
|
||||
} else {
|
||||
|
||||
return file
|
||||
}
|
||||
})
|
||||
|
||||
case "EDIT_FILE_METADATA":
|
||||
|
||||
return state.map((file) => {
|
||||
|
||||
if (file._id === action.id) {
|
||||
|
||||
return {...file, metadata: {...file.metadata, ...action.metadata}}
|
||||
|
||||
} else {
|
||||
|
||||
return file
|
||||
}
|
||||
})
|
||||
|
||||
case "REMOVE_FILE":
|
||||
|
||||
return state.filter((file) => {
|
||||
|
||||
return file._id !== action.id
|
||||
})
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
const defaultState = {
|
||||
id: "",
|
||||
openIDs: {},
|
||||
newIDs: {},
|
||||
newID: "",
|
||||
deleteIDs: {},
|
||||
deleteID: "",
|
||||
moveIDs: {},
|
||||
moveID: "",
|
||||
renameIDs: {},
|
||||
renameID: "",
|
||||
firstLoadDetails: {},
|
||||
insertedIDs: {},
|
||||
insertedID: "",
|
||||
};
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
switch (action.type) {
|
||||
case "SET_ID":
|
||||
return {
|
||||
...state,
|
||||
id: action.id,
|
||||
openIDs: {
|
||||
...state.openIDs,
|
||||
[action.id]: true,
|
||||
},
|
||||
};
|
||||
|
||||
case "SET_FIRST_LOAD_DETAILS":
|
||||
return {
|
||||
...state,
|
||||
firstLoadDetails: action.firstLoadDetails,
|
||||
};
|
||||
|
||||
case "ADD_NEW_IDS":
|
||||
return {
|
||||
...state,
|
||||
newID: action.id,
|
||||
newIDs: {
|
||||
...state.newIDs,
|
||||
[action.id]: action.addData,
|
||||
},
|
||||
};
|
||||
|
||||
case "REMOVE_NEW_IDS": {
|
||||
const { [action.id]: _, ...nonRemovedIds } = state.newIDs;
|
||||
|
||||
return {
|
||||
...state,
|
||||
newIDs: nonRemovedIds,
|
||||
newID: "",
|
||||
};
|
||||
}
|
||||
|
||||
case "SET_INSERT_IDS": {
|
||||
return {
|
||||
...state,
|
||||
insertedIDs: action.insertedList,
|
||||
insertedID: action.id,
|
||||
};
|
||||
}
|
||||
|
||||
case "REMOVE_INSERT_IDS": {
|
||||
return {};
|
||||
}
|
||||
|
||||
case "ADD_DELETE_IDS": {
|
||||
return {
|
||||
...state,
|
||||
deleteID: action.id,
|
||||
deleteIDs: {
|
||||
...state.deleteIDs,
|
||||
[action.id]: action.deleteData,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
case "REMOVE_DELETE_IDS": {
|
||||
const { [action.id]: _, ...nonRemovedIds } = state.deleteIDs;
|
||||
|
||||
return {
|
||||
...state,
|
||||
deleteIDs: nonRemovedIds,
|
||||
deleteID: "",
|
||||
};
|
||||
}
|
||||
|
||||
case "ADD_MOVE_IDS": {
|
||||
return {
|
||||
...state,
|
||||
moveID: action.id,
|
||||
moveIDs: {
|
||||
...state.moveIDs,
|
||||
[action.id]: action.moveData,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
case "REMOVE_MOVE_IDS": {
|
||||
const { [action.id]: _, ...nonRemovedIds } = state.moveIDs;
|
||||
|
||||
return {
|
||||
...state,
|
||||
moveID: "",
|
||||
moveIDs: nonRemovedIds,
|
||||
};
|
||||
}
|
||||
|
||||
case "ADD_RENAME_IDS": {
|
||||
return {
|
||||
...state,
|
||||
renameID: action.id,
|
||||
renameIDs: {
|
||||
...state.renameIDs,
|
||||
[action.id]: action.renameData,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
case "REMOVE_RENAME_IDS": {
|
||||
const { [action.id]: _, ...nonRemovedIds } = state.renameIDs;
|
||||
|
||||
return {
|
||||
...state,
|
||||
renameID: "",
|
||||
renameIDs: nonRemovedIds,
|
||||
};
|
||||
}
|
||||
|
||||
case "REMOVE_ID":
|
||||
const { [action.id]: _, ...nonRemovedIds } = state.openIDs;
|
||||
|
||||
return {
|
||||
...state,
|
||||
id: "-",
|
||||
openIDs: nonRemovedIds,
|
||||
};
|
||||
|
||||
case "RESET_ID":
|
||||
return {
|
||||
...state,
|
||||
id: "",
|
||||
openIDs: {},
|
||||
};
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
export default (state = [], action) => {
|
||||
|
||||
switch(action.type) {
|
||||
|
||||
case "ADD_FOLDER":
|
||||
|
||||
return [
|
||||
action.folder,
|
||||
...state
|
||||
]
|
||||
|
||||
case "EDIT_FOLDER":
|
||||
|
||||
return state.map((folder) => {
|
||||
|
||||
if (folder._id === action.id) {
|
||||
|
||||
return {...folder, ...action.folder}
|
||||
|
||||
} else {
|
||||
|
||||
return folder
|
||||
}
|
||||
})
|
||||
|
||||
case "SET_FOLDERS":
|
||||
|
||||
return action.folders;
|
||||
|
||||
case "REMOVE_FOLDER":
|
||||
|
||||
return state.filter((folder) => {
|
||||
return action.id !== folder._id;
|
||||
})
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
import moment from "moment"
|
||||
|
||||
const defaultState = {
|
||||
showSideBar: true,
|
||||
uploaderShow: true,
|
||||
resetItems: moment.now(),
|
||||
loadMoreItems: false,
|
||||
loading: false,
|
||||
loginFailed: false,
|
||||
loginFailedCode: 401,
|
||||
createNewAccount: false,
|
||||
currentRouteType: "home",
|
||||
cachedSearch: "",
|
||||
uploadOverlayOpen: false,
|
||||
leftSectionMode: "",
|
||||
rightSectionMode: "",
|
||||
loadingMoreItems: false
|
||||
// resetSettingsMain: "",
|
||||
}
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
// case "RESET_SETTINGS_MAIN": {
|
||||
|
||||
// console.log("Redux reset settings", action.id)
|
||||
|
||||
// return {
|
||||
// ...state,
|
||||
// resetSettingsMain: action.id
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
case "LOADING_MORE_ITEMS": {
|
||||
|
||||
return {
|
||||
...state,
|
||||
loadingMoreItems: action.loading
|
||||
}
|
||||
}
|
||||
|
||||
case "SET_LEFT_SECTION_MODE": {
|
||||
|
||||
return {
|
||||
...state,
|
||||
leftSectionMode: action.mode
|
||||
}
|
||||
}
|
||||
|
||||
case "SET_RIGHT_SECTION_MODE": {
|
||||
|
||||
return {
|
||||
...state,
|
||||
rightSectionMode: action.mode
|
||||
}
|
||||
}
|
||||
|
||||
case "OPEN_UPLOAD_OVERLAY": {
|
||||
|
||||
return {
|
||||
...state,
|
||||
uploadOverlayOpen: true
|
||||
}
|
||||
}
|
||||
|
||||
case "CLOSE_UPLOAD_OVERLAY": {
|
||||
|
||||
return {
|
||||
...state,
|
||||
uploadOverlayOpen: false
|
||||
}
|
||||
}
|
||||
|
||||
case "SET_CACHED_SEARCH":
|
||||
|
||||
return {
|
||||
...state,
|
||||
cachedSearch: action.search
|
||||
}
|
||||
|
||||
case "SET_CURRENT_ROUTE_TYPE":
|
||||
|
||||
return {
|
||||
...state,
|
||||
currentRouteType: action.route
|
||||
}
|
||||
|
||||
case "SET_CREATE_NEW_ACCOUNT":
|
||||
|
||||
return {
|
||||
...state,
|
||||
createNewAccount: action.value
|
||||
}
|
||||
|
||||
case "SET_LOGIN_FAILED":
|
||||
|
||||
return {
|
||||
...state,
|
||||
loginFailed: action.message,
|
||||
loginFailedCode: action.code
|
||||
}
|
||||
|
||||
case "SET_LOADING":
|
||||
|
||||
return {
|
||||
...state,
|
||||
loading: action.load
|
||||
}
|
||||
|
||||
|
||||
case "LOAD_MORE_ITEMS":
|
||||
|
||||
return {
|
||||
|
||||
...state,
|
||||
loadMoreItems: action.load
|
||||
}
|
||||
|
||||
case "RESET_ITEMS":
|
||||
|
||||
return {
|
||||
...state,
|
||||
resetItems: moment.now()
|
||||
}
|
||||
|
||||
case "SHOW_UPLOADER": {
|
||||
|
||||
return {
|
||||
...state,
|
||||
uploaderShow: true
|
||||
}
|
||||
}
|
||||
|
||||
case "HIDE_UPLOADER": {
|
||||
|
||||
return {
|
||||
...state,
|
||||
uploaderShow: false
|
||||
}
|
||||
}
|
||||
|
||||
case "SHOW_SIDEBAR":
|
||||
|
||||
return {
|
||||
...state,
|
||||
showSideBar: true
|
||||
}
|
||||
case "HIDE_SIDEBAR":
|
||||
|
||||
return {
|
||||
...state,
|
||||
showSideBar: false
|
||||
}
|
||||
|
||||
case "GONE_SIDEBAR":
|
||||
|
||||
return {
|
||||
...state,
|
||||
showSideBar: "gone"
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
const defaultState = {
|
||||
open: false,
|
||||
isFile: false,
|
||||
data: {}
|
||||
}
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
case "SET_MOBILE_CONTEXT": {
|
||||
|
||||
return {
|
||||
...state,
|
||||
open: true,
|
||||
isFile: action.isFile,
|
||||
data: action.data
|
||||
}
|
||||
}
|
||||
|
||||
case "RESET_MOBILE_CONTEXT": {
|
||||
|
||||
return {
|
||||
...state,
|
||||
open: false
|
||||
};
|
||||
}
|
||||
|
||||
default: {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
const defaultState = {
|
||||
id: "",
|
||||
parent: "/",
|
||||
isFile: true,
|
||||
};
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
switch (action.type) {
|
||||
case "SET_MOVER_ID":
|
||||
return {
|
||||
...state,
|
||||
id: action.id,
|
||||
parent: action.parent,
|
||||
isFile: action.isFile,
|
||||
};
|
||||
|
||||
case "RESET_MOVER_ID":
|
||||
return {
|
||||
...state,
|
||||
id: "",
|
||||
parent: "/",
|
||||
isFile: action.isFile,
|
||||
};
|
||||
|
||||
default: {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,42 +0,0 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { FileInterface } from "../types/file";
|
||||
import { FolderInterface } from "../types/folders";
|
||||
|
||||
export type SelectedStateType = {
|
||||
type: "" | "file" | "folder";
|
||||
file: FileInterface | null;
|
||||
folder: FolderInterface | null;
|
||||
};
|
||||
|
||||
type MoverStateType = {
|
||||
selectedItem: SelectedStateType;
|
||||
};
|
||||
|
||||
const initialState: MoverStateType = {
|
||||
selectedItem: {
|
||||
type: "",
|
||||
file: null,
|
||||
folder: null,
|
||||
},
|
||||
};
|
||||
|
||||
const moveSlice = createSlice({
|
||||
name: "selected",
|
||||
initialState,
|
||||
reducers: {
|
||||
setMoverItem: (state, action: PayloadAction<SelectedStateType>) => {
|
||||
state.selectedItem = action.payload;
|
||||
},
|
||||
resetMoverItem: (state) => {
|
||||
state.selectedItem = {
|
||||
type: "",
|
||||
file: null,
|
||||
folder: null,
|
||||
};
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const {} = moveSlice.actions;
|
||||
|
||||
export default moveSlice.reducer;
|
||||
@@ -1,69 +0,0 @@
|
||||
const defaultState = {
|
||||
parentList: ["/"],
|
||||
parentNameList: ["Home"],
|
||||
parent: "/"
|
||||
}
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
case "SET_PARENT":
|
||||
|
||||
return {
|
||||
...state,
|
||||
parent: action.parent,
|
||||
}
|
||||
case "ADD_PARENT_LIST":
|
||||
|
||||
return {
|
||||
...state,
|
||||
parentList: [...state.parentList, action.parent],
|
||||
parentNameList: [...state.parentNameList, action.name]
|
||||
}
|
||||
|
||||
case "ADJUST_PARENT_LIST":
|
||||
|
||||
return {
|
||||
...state,
|
||||
parentList: action.parentList,
|
||||
parentNameList: action.parentNameList
|
||||
}
|
||||
|
||||
case "SET_PARENT_LIST":
|
||||
|
||||
return {
|
||||
...state,
|
||||
parentList: action.parentList,
|
||||
parentNameList: action.parentNameList
|
||||
}
|
||||
|
||||
case "REMOVE_PARENT_LIST":
|
||||
|
||||
return {
|
||||
...state,
|
||||
parentList: parentList.filter((parent) => {
|
||||
return parent._id !== action.parent
|
||||
})
|
||||
}
|
||||
|
||||
case "RESET_PARENT_LIST":
|
||||
|
||||
return {
|
||||
...state,
|
||||
parentList: ["/"],
|
||||
parentNameList: ["Home"]
|
||||
}
|
||||
|
||||
case "ADD_PARENT_NAME_LIST":
|
||||
|
||||
return {
|
||||
...state,
|
||||
parentNameList: [...state.parentNameList, action.name]
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
const defaultState = {
|
||||
id: "",
|
||||
isGoogle: false,
|
||||
isPersonal: false,
|
||||
}
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
|
||||
switch(action.type) {
|
||||
|
||||
case "SET_PHOTO_ID":
|
||||
|
||||
return {
|
||||
...state,
|
||||
id: action.id,
|
||||
isGoogle: action.isGoogle,
|
||||
isPersonal: action.isPersonal
|
||||
}
|
||||
|
||||
case "RESET_PHOTO_ID":
|
||||
|
||||
return {
|
||||
...state,
|
||||
id: "",
|
||||
isGoogle: false,
|
||||
isPersonal: false,
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
const defaultState = {
|
||||
showPopup: false
|
||||
}
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
|
||||
switch(action.type) {
|
||||
|
||||
case "SET_POPUP_FILE":
|
||||
|
||||
return action.file
|
||||
|
||||
case "SHOW_POPUP":
|
||||
|
||||
return {
|
||||
...state,
|
||||
showPopup: true
|
||||
}
|
||||
|
||||
case "HIDE_POPUP":
|
||||
|
||||
return {
|
||||
...state,
|
||||
showPopup: false
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
return state;
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
import mobilecheck from "../utils/mobileCheck";
|
||||
|
||||
const defaultState = [];
|
||||
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
|
||||
switch(action.type) {
|
||||
|
||||
case "SET_QUICK_FILES":
|
||||
|
||||
return action.files
|
||||
|
||||
case "ADD_QUICK_FILE": {
|
||||
|
||||
if ((mobilecheck() && state.length >= 2) || state.length >= 10) {
|
||||
let temp = state;
|
||||
temp.pop()
|
||||
return [action.file, ...state]
|
||||
} else {
|
||||
return [action.file, ...state]
|
||||
}
|
||||
}
|
||||
|
||||
case "EDIT_FILE":
|
||||
|
||||
return state.map((file) => {
|
||||
|
||||
if (file._id === action.id) {
|
||||
|
||||
return {...file, ...action.file}
|
||||
|
||||
} else {
|
||||
|
||||
return file
|
||||
}
|
||||
})
|
||||
|
||||
case "REMOVE_FILE":
|
||||
|
||||
return state.filter((file) => {
|
||||
|
||||
return file._id !== action.id
|
||||
})
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
const defaultState = {
|
||||
currentRoute: "/home"
|
||||
}
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
case "SET_CURRENT_ROUTE":
|
||||
|
||||
return {
|
||||
...state,
|
||||
currentRoute: action.route
|
||||
}
|
||||
|
||||
case "RESET_CURRENT_ROUTE":
|
||||
|
||||
return {
|
||||
...state,
|
||||
currentRoute: "/home"
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
const defaultState = {
|
||||
name: "",
|
||||
id: "",
|
||||
selected: "",
|
||||
rightSelected: "",
|
||||
shareSelected: "",
|
||||
selectedItem: "",
|
||||
lastSelected: 0,
|
||||
|
||||
}
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
case "SET_SELECTED":
|
||||
|
||||
return {
|
||||
...state,
|
||||
selected: action.selected
|
||||
}
|
||||
|
||||
case "SET_SELECTED_ITEM":
|
||||
|
||||
return {
|
||||
...state,
|
||||
...action.selectedItem
|
||||
}
|
||||
|
||||
case "EDIT_SELECTED_ITEM":
|
||||
|
||||
return {
|
||||
...state,
|
||||
...action.item
|
||||
}
|
||||
|
||||
case "RESET_SELECTED_ITEM":
|
||||
|
||||
return defaultState
|
||||
|
||||
case "EDIT_SHARE_SELECTED":
|
||||
|
||||
return {
|
||||
...state,
|
||||
shareSelected: {
|
||||
...state.shareSelected,
|
||||
...action.selected
|
||||
}
|
||||
}
|
||||
|
||||
case "SET_SHARE_SELECTED":
|
||||
|
||||
return {
|
||||
...state,
|
||||
shareSelected: action.selected
|
||||
}
|
||||
|
||||
case "SET_RIGHT_SELECTED":
|
||||
|
||||
return {
|
||||
...state,
|
||||
rightSelected: action.selected
|
||||
}
|
||||
|
||||
case "SET_LAST_SELECTED":
|
||||
|
||||
return {
|
||||
...state,
|
||||
lastSelected: action.lastSelected
|
||||
}
|
||||
|
||||
case "RESET_SELECTED":
|
||||
|
||||
return {
|
||||
...state,
|
||||
selected: ""
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
const defaultState = {
|
||||
|
||||
showSettings: false
|
||||
}
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
case "SHOW_SETTINGS":
|
||||
|
||||
return {
|
||||
...state,
|
||||
showSettings: true
|
||||
}
|
||||
|
||||
|
||||
case "HIDE_SETTINGS":
|
||||
|
||||
return {
|
||||
...state,
|
||||
showSettings: false
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
|
||||
return state;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
const defaultState = {
|
||||
free: 0,
|
||||
total: 0,
|
||||
available: 0
|
||||
}
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
case "SET_STORAGE":
|
||||
|
||||
return {
|
||||
...action.info
|
||||
}
|
||||
|
||||
case "RESET_STORAGE":
|
||||
|
||||
return defaultState
|
||||
|
||||
default:
|
||||
|
||||
return state;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
const defaultState = {
|
||||
selected: ""
|
||||
}
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
case "SET_UPLOAD_SWITCHER_ID": {
|
||||
|
||||
return {
|
||||
...state,
|
||||
selected: action.storage
|
||||
}
|
||||
}
|
||||
|
||||
case "RESET_UPLOAD_SWITCHER_ID": {
|
||||
|
||||
return {
|
||||
...state,
|
||||
selected: ""
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
const defaultState = [];
|
||||
|
||||
export default (state = defaultState, action) => {
|
||||
switch (action.type) {
|
||||
case "ADD_UPLOAD":
|
||||
return [action.upload, ...state];
|
||||
|
||||
case "EDIT_UPLOAD":
|
||||
return state.map((upload) => {
|
||||
if (upload.id === action.id) {
|
||||
return {
|
||||
...upload,
|
||||
progress: action.progress,
|
||||
completed: action.completed,
|
||||
};
|
||||
}
|
||||
|
||||
return upload;
|
||||
});
|
||||
|
||||
case "CANCEL_UPLOAD":
|
||||
return state.map((upload) => {
|
||||
if (upload.id === action.id) {
|
||||
return {
|
||||
...upload,
|
||||
canceled: true,
|
||||
};
|
||||
}
|
||||
|
||||
return upload;
|
||||
});
|
||||
|
||||
case "RESET_UPLOADS":
|
||||
return [];
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -1,55 +1,17 @@
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import authReducer from "../reducers/auth";
|
||||
import mainReducer from "../reducers/main";
|
||||
import fileReducer from "../reducers/files";
|
||||
import folderReducer from "../reducers/folders";
|
||||
import filterReducer from "../reducers/filter";
|
||||
import selectedItemReducer from "../reducers/selectedItem";
|
||||
import uploadsReducer from "../reducers/uploads";
|
||||
import storageReducer from "../reducers/storage";
|
||||
import quickFilesReducer from "../reducers/quickFiles";
|
||||
import popupFilesReducer from "../reducers/popupFile";
|
||||
import settingsReducer from "../reducers/settings";
|
||||
import parentReducer from "../reducers/parent";
|
||||
import addOptionsReducer from "../reducers/addOptions";
|
||||
import photoViewerReducer from "../reducers/photoViewer";
|
||||
import routesReducer from "../reducers/routes";
|
||||
import moverReducer from "../reducers/mover";
|
||||
import folderTreeReducer from "../reducers/folderTree";
|
||||
import uploadStorageSwitcherReducer from "../reducers/uploadStorageSwitcher";
|
||||
import mobileContextMenuReducer from "../reducers/mobileContextMenu";
|
||||
import selectedReducer from "../reducers/selected";
|
||||
import leftSectionReducer from "../reducers/leftSection";
|
||||
import userReducer from "../reducers/user";
|
||||
import uploaderReducer from "../reducers/uploader";
|
||||
|
||||
//const composeEnchancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
||||
|
||||
const store = configureStore({
|
||||
reducer: {
|
||||
auth: authReducer,
|
||||
main: mainReducer,
|
||||
// files: fileReducer,
|
||||
// folders: folderReducer,
|
||||
filter: filterReducer,
|
||||
selected: selectedReducer,
|
||||
leftSection: leftSectionReducer,
|
||||
// selectedItem: selectedItemReducer,
|
||||
uploads: uploadsReducer,
|
||||
user: userReducer,
|
||||
uploader: uploaderReducer,
|
||||
// storage: storageReducer,
|
||||
// quickFiles: quickFilesReducer,
|
||||
// popupFile: popupFilesReducer,
|
||||
// settings: settingsReducer,
|
||||
// parent: parentReducer,
|
||||
// addOptions: addOptionsReducer,
|
||||
// photoViewer: photoViewerReducer,
|
||||
// routes: routesReducer,
|
||||
// mover: moverReducer,
|
||||
// folderTree: folderTreeReducer,
|
||||
// storageSwitcher: uploadStorageSwitcherReducer,
|
||||
// mobileContextMenu: mobileContextMenuReducer,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user