🔩 Light refactoring
This commit is contained in:
@@ -10,7 +10,11 @@ import { FS_API_BASE_URI } from "../constants/endpoints";
|
|||||||
export async function walkFolder(path: string): Promise<Array<IFolderData>> {
|
export async function walkFolder(path: string): Promise<Array<IFolderData>> {
|
||||||
return axios
|
return axios
|
||||||
.request<Array<IFolderData>>({
|
.request<Array<IFolderData>>({
|
||||||
url: FS_API_BASE_URI + "/walkFolder",
|
url: FS_API_BASE_URI + "walkFolder",
|
||||||
|
method: "POST",
|
||||||
|
params: {
|
||||||
|
basePathToWalk: path,
|
||||||
|
},
|
||||||
transformResponse: (r: string) => JSON.parse(r),
|
transformResponse: (r: string) => JSON.parse(r),
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Import extends React.Component<IProps, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async startFolderWalk() {
|
public async startFolderWalk() {
|
||||||
console.log(await greet('dog'));
|
console.log(await greet("./comics"));
|
||||||
}
|
}
|
||||||
public render() {
|
public render() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
13
src/client/types/index.d.ts
vendored
13
src/client/types/index.d.ts
vendored
@@ -2,19 +2,6 @@ declare module "*.png" {
|
|||||||
const value: string;
|
const value: string;
|
||||||
export = value;
|
export = value;
|
||||||
}
|
}
|
||||||
// declare module "*.worker.ts" {
|
|
||||||
// class ImportComicBooksWorker extends Worker {
|
|
||||||
// constructor();
|
|
||||||
// }
|
|
||||||
// export default ImportComicBooksWorker;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// declare module "worker-loader!*" {
|
|
||||||
// class WebpackWorker extends Worker {
|
|
||||||
// constructor();
|
|
||||||
// }
|
|
||||||
// export default WebpackWorker;
|
|
||||||
// }
|
|
||||||
|
|
||||||
declare module "*.jpg";
|
declare module "*.jpg";
|
||||||
declare module "*.gif";
|
declare module "*.gif";
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
export async function greet(subject: string): string {
|
import { walkFolder } from "../actions/fileops.actions";
|
||||||
return `Hello, ${subject}!`;
|
import { IFolderData } from "../../server/interfaces/folder.interface";
|
||||||
|
|
||||||
|
export async function greet(path: string): Promise<IFolderData[]> {
|
||||||
|
console.log(path);
|
||||||
|
return await walkFolder("./comics");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user