Mock upload call

This commit is contained in:
Akshay
2023-10-08 21:40:17 +05:30
parent 01457bbe79
commit ff1362e462
3 changed files with 20 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
import jsonServer from "json-server";
import routes from "./mocks/routes.json" assert { type: "json" };
import { v4 as uuid } from "uuid";
const server = jsonServer.create();
const router = jsonServer.router("./src/mocks/db.json");
@@ -11,6 +12,9 @@ server.use((req, res, next) => {
if (req.method === "POST") {
if (req.url.includes("/delete_conversation")) {
req.method = "DELETE";
} else if (req.url === "/upload") {
const taskId = uuid();
localStorage.setItem(taskId, true);
}
}
next();