Skip to content

Commit 6188b92

Browse files
committed
Remove unused code
1 parent fa9800f commit 6188b92

File tree

2 files changed

+1
-40
lines changed

2 files changed

+1
-40
lines changed

resources/scripts/state/server/files.ts

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,13 @@
1-
import loadDirectory, { FileObject } from '@/api/server/files/loadDirectory';
2-
import { action, Action, thunk, Thunk } from 'easy-peasy';
3-
import { ServerStore } from '@/state/server/index';
1+
import { action, Action } from 'easy-peasy';
42
import { cleanDirectoryPath } from '@/helpers';
53

64
export interface ServerFileStore {
75
directory: string;
8-
contents: FileObject[];
9-
getDirectoryContents: Thunk<ServerFileStore, string, Record<string, unknown>, ServerStore, Promise<void>>;
10-
setContents: Action<ServerFileStore, FileObject[]>;
11-
pushFile: Action<ServerFileStore, FileObject>;
12-
removeFile: Action<ServerFileStore, string>;
136
setDirectory: Action<ServerFileStore, string>;
147
}
158

169
const files: ServerFileStore = {
1710
directory: '/',
18-
contents: [],
19-
20-
getDirectoryContents: thunk(async (actions, payload, { getStoreState }) => {
21-
const server = getStoreState().server.data;
22-
if (!server) {
23-
return;
24-
}
25-
26-
const contents = await loadDirectory(server.uuid, cleanDirectoryPath(payload));
27-
28-
actions.setDirectory(payload.length === 0 ? '/' : payload);
29-
actions.setContents(contents);
30-
}),
31-
32-
setContents: action((state, payload) => {
33-
state.contents = payload;
34-
}),
35-
36-
pushFile: action((state, payload) => {
37-
const matchIndex = state.contents.findIndex(file => file.uuid === payload.uuid);
38-
if (matchIndex < 0) {
39-
state.contents = state.contents.concat(payload);
40-
return;
41-
}
42-
43-
state.contents[matchIndex] = payload;
44-
}),
45-
46-
removeFile: action((state, payload) => {
47-
state.contents = state.contents.filter(file => file.uuid !== payload);
48-
}),
4911

5012
setDirectory: action((state, payload) => {
5113
state.directory = cleanDirectoryPath(payload);

resources/scripts/state/server/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ export const ServerContext = createContextStore<ServerStore>({
7777
state.databases.data = [];
7878
state.subusers.data = [];
7979
state.files.directory = '/';
80-
state.files.contents = [];
8180
state.backups.data = [];
8281
state.schedules.data = [];
8382

0 commit comments

Comments
 (0)