diff --git a/gui/web/package.json b/gui/web/package.json index 8fe0a3658..b437ddabd 100644 --- a/gui/web/package.json +++ b/gui/web/package.json @@ -10,7 +10,8 @@ "react-router-dom": "^5.0.0", "react-scripts": "2.1.8", "react-tooltip-lite": "^1.10.0", - "stellar-sdk": "^3.0.0" + "stellar-sdk": "^3.0.0", + "uuid": "^8.3.2" }, "scripts": { "start": "react-scripts start", diff --git a/gui/web/src/kelp-ops-api/getUserData.js b/gui/web/src/kelp-ops-api/getUserData.js index 72522832c..b102f21f7 100644 --- a/gui/web/src/kelp-ops-api/getUserData.js +++ b/gui/web/src/kelp-ops-api/getUserData.js @@ -1,5 +1,15 @@ +import { v4 as uuidv4 } from "uuid"; + export default () => { + const userIDKey = 'user_id'; + + let userId = localStorage.getItem(userIDKey); + if (userId == null) { + userId = uuidv4(); + localStorage.setItem(userIDKey, userId); + } + return { - ID: "1347129431489", + ID: userId, }; }; \ No newline at end of file diff --git a/gui/web/yarn.lock b/gui/web/yarn.lock index 1bff8b6e9..d39d519e0 100644 --- a/gui/web/yarn.lock +++ b/gui/web/yarn.lock @@ -10307,6 +10307,11 @@ uuid@^3.0.1, uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +uuid@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a"