diff --git a/mock-backend/package-lock.json b/mock-backend/package-lock.json index 55e49560..5a3378fc 100644 --- a/mock-backend/package-lock.json +++ b/mock-backend/package-lock.json @@ -9,7 +9,8 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "json-server": "^0.17.4" + "json-server": "^0.17.4", + "uuid": "^9.0.1" }, "devDependencies": { "@types/json-server": "^0.14.5" @@ -1226,6 +1227,18 @@ "node": ">= 0.4.0" } }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/mock-backend/package.json b/mock-backend/package.json index 8b0b358d..7cfab8c3 100644 --- a/mock-backend/package.json +++ b/mock-backend/package.json @@ -12,7 +12,8 @@ "author": "", "license": "ISC", "dependencies": { - "json-server": "^0.17.4" + "json-server": "^0.17.4", + "uuid": "^9.0.1" }, "devDependencies": { "@types/json-server": "^0.14.5" diff --git a/mock-backend/src/server.js b/mock-backend/src/server.js index 02867229..2e4d907c 100644 --- a/mock-backend/src/server.js +++ b/mock-backend/src/server.js @@ -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();