23 lines
592 B
TypeScript
23 lines
592 B
TypeScript
import http from '@/api/http';
|
|
import { rawDataToFileObject } from '@/api/transformers';
|
|
|
|
export interface FileObject {
|
|
uuid: string;
|
|
name: string;
|
|
mode: string;
|
|
size: number;
|
|
isFile: boolean;
|
|
isSymlink: boolean;
|
|
isEditable: boolean;
|
|
mimetype: string;
|
|
createdAt: Date;
|
|
modifiedAt: Date;
|
|
}
|
|
|
|
export default async (uuid: string, directory?: string): Promise<FileObject[]> => {
|
|
const { data } = await http.get(`/api/client/servers/${uuid}/files/list`, {
|
|
params: { directory },
|
|
});
|
|
|
|
return (data.data || []).map(rawDataToFileObject);
|
|
};
|