1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

upload mock

This commit is contained in:
muerwre 2019-08-06 18:41:37 +07:00
parent ba26b374ba
commit 5659914f3f
4 changed files with 19 additions and 9 deletions

View file

@ -1,12 +1,15 @@
import { IResultWithStatus, IFile } from "../types";
import { IResultWithStatus, IFile, UUID } from "../types";
import { HTTP_RESPONSES } from "~/utils/api";
import { EMPTY_FILE } from "./constants";
import uuid from 'uuid4';
export const uploadMock = (file: File): Promise<IResultWithStatus<IFile>> => (
Promise.resolve(() => ({
export const uploadMock = ({ temp_id, file }: { temp_id: UUID, file: File }): Promise<IResultWithStatus<IFile>> => (
Promise.resolve({
status: HTTP_RESPONSES.CREATED,
data: {
...EMPTY_FILE,
id: uuid(),
temp_id,
},
error: null,
}))
);
}));