Update environment variables, add fingerprinting, and refactor API endpoints
- Changed server socket and REST API base URLs in .env file. - Added FingerprintJS dependencies to package.json and package-lock.json. - Implemented fingerprint generation in UserAuth component. - Updated API endpoints from v1 to v2 in various service files. - Refactored API calls to include authorization tokens. - Commented out console log statements for cleaner production code.
This commit is contained in:
parent
b99981a661
commit
b76213f49f
6
app/.env
6
app/.env
|
@ -2,12 +2,12 @@
|
|||
PORT=8200
|
||||
|
||||
# Base URL for the server socket API, used for real-time communication (e.g., WebSockets).
|
||||
REACT_APP_SERVER_SOCKET_API_BASE_URL=192.168.0.110:8000
|
||||
REACT_APP_SERVER_SOCKET_API_BASE_URL=192.168.0.102:8000
|
||||
# REACT_APP_SERVER_SOCKET_API_BASE_URL=185.100.212.76:8000
|
||||
|
||||
# Base URL for the server REST API, used for HTTP requests to the backend server.
|
||||
REACT_APP_SERVER_REST_API_BASE_URL=192.168.0.110:5000
|
||||
# REACT_APP_SERVER_REST_API_BASE_URL=192.168.0.102:5000
|
||||
# REACT_APP_SERVER_REST_API_BASE_URL=192.168.0.110:5000
|
||||
REACT_APP_SERVER_REST_API_BASE_URL=192.168.0.102:5000
|
||||
# REACT_APP_SERVER_REST_API_BASE_URL=185.100.212.76:5000
|
||||
|
||||
# Base URL for the server marketplace, used for market place model blob.
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@fingerprintjs/fingerprintjs": "^4.6.2",
|
||||
"@fingerprintjs/fingerprintjs-pro-react": "^2.6.3",
|
||||
"@react-three/csg": "^3.2.0",
|
||||
"@react-three/drei": "^9.113.0",
|
||||
"@react-three/fiber": "^8.17.7",
|
||||
|
@ -30,6 +32,7 @@
|
|||
"glob": "^11.0.0",
|
||||
"gsap": "^3.12.5",
|
||||
"html2canvas": "^1.4.1",
|
||||
"immer": "^10.1.1",
|
||||
"leva": "^0.10.0",
|
||||
"mqtt": "^5.10.4",
|
||||
"postprocessing": "^6.36.4",
|
||||
|
@ -2021,7 +2024,7 @@
|
|||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
||||
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "0.3.9"
|
||||
},
|
||||
|
@ -2033,7 +2036,7 @@
|
|||
"version": "0.3.9",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
|
||||
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
|
@ -2535,6 +2538,45 @@
|
|||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@fingerprintjs/fingerprintjs": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@fingerprintjs/fingerprintjs/-/fingerprintjs-4.6.2.tgz",
|
||||
"integrity": "sha512-g8mXuqcFKbgH2CZKwPfVtsUJDHyvcgIABQI7Y0tzWEFXpGxJaXuAuzlifT2oTakjDBLTK4Gaa9/5PERDhqUjtw==",
|
||||
"license": "BUSL-1.1",
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@fingerprintjs/fingerprintjs-pro": {
|
||||
"version": "3.11.10",
|
||||
"resolved": "https://registry.npmjs.org/@fingerprintjs/fingerprintjs-pro/-/fingerprintjs-pro-3.11.10.tgz",
|
||||
"integrity": "sha512-zuQWT0YQLT0T//KcjEnyn4YBPlxXuXCtPiwEt2eTv03I/k2m370X+pCOfgU26AEjkmPrhCE77FLpRnm0IwiWrg==",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@fingerprintjs/fingerprintjs-pro-react": {
|
||||
"version": "2.6.3",
|
||||
"resolved": "https://registry.npmjs.org/@fingerprintjs/fingerprintjs-pro-react/-/fingerprintjs-pro-react-2.6.3.tgz",
|
||||
"integrity": "sha512-/axCq/cfjZkIM+WFZM/05FQvqtNfdKbIFKU6b2yrwPKlgT8BqWkAq8XvFX6JCPlq8/udVLJjFEDCK+1JQh1L6g==",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fingerprintjs/fingerprintjs-pro-spa": "^1.3.1",
|
||||
"fast-deep-equal": "3.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@fingerprintjs/fingerprintjs-pro-spa": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@fingerprintjs/fingerprintjs-pro-spa/-/fingerprintjs-pro-spa-1.3.2.tgz",
|
||||
"integrity": "sha512-s1YGsx1XQLmjU+av4UrUHNxyzwPHyZRB0GXJQFOJK8ZHCYc2SNukxnJmZA++bNBa8twU3wW+QgSJhA4Prjnd0g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fingerprintjs/fingerprintjs-pro": "^3.11.0",
|
||||
"tslib": "^2.7.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@floating-ui/core": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-0.7.3.tgz",
|
||||
|
@ -4136,6 +4178,26 @@
|
|||
"url": "https://github.com/sponsors/gregberge"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/dom": {
|
||||
"version": "10.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz",
|
||||
"integrity": "sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.10.4",
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@types/aria-query": "^5.0.1",
|
||||
"aria-query": "5.3.0",
|
||||
"chalk": "^4.1.0",
|
||||
"dom-accessibility-api": "^0.5.9",
|
||||
"lz-string": "^1.5.0",
|
||||
"pretty-format": "^27.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/jest-dom": {
|
||||
"version": "5.17.0",
|
||||
"resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.17.0.tgz",
|
||||
|
@ -4247,25 +4309,25 @@
|
|||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz",
|
||||
"integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==",
|
||||
"dev": true
|
||||
"devOptional": true
|
||||
},
|
||||
"node_modules/@tsconfig/node12": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
|
||||
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
|
||||
"dev": true
|
||||
"devOptional": true
|
||||
},
|
||||
"node_modules/@tsconfig/node14": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
|
||||
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
|
||||
"dev": true
|
||||
"devOptional": true
|
||||
},
|
||||
"node_modules/@tsconfig/node16": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
|
||||
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
|
||||
"dev": true
|
||||
"devOptional": true
|
||||
},
|
||||
"node_modules/@turf/along": {
|
||||
"version": "7.2.0",
|
||||
|
@ -9019,7 +9081,7 @@
|
|||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
|
||||
"dev": true
|
||||
"devOptional": true
|
||||
},
|
||||
"node_modules/cross-env": {
|
||||
"version": "7.0.3",
|
||||
|
@ -9896,7 +9958,7 @@
|
|||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"engines": {
|
||||
"node": ">=0.3.1"
|
||||
}
|
||||
|
@ -12726,9 +12788,10 @@
|
|||
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="
|
||||
},
|
||||
"node_modules/immer": {
|
||||
"version": "9.0.21",
|
||||
"resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz",
|
||||
"integrity": "sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA==",
|
||||
"version": "10.1.1",
|
||||
"resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz",
|
||||
"integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/immer"
|
||||
|
@ -15259,7 +15322,7 @@
|
|||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
|
||||
"dev": true
|
||||
"devOptional": true
|
||||
},
|
||||
"node_modules/makeerror": {
|
||||
"version": "1.0.12",
|
||||
|
@ -17990,6 +18053,16 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/react-dev-utils/node_modules/immer": {
|
||||
"version": "9.0.21",
|
||||
"resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz",
|
||||
"integrity": "sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/immer"
|
||||
}
|
||||
},
|
||||
"node_modules/react-dev-utils/node_modules/loader-utils": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.3.1.tgz",
|
||||
|
@ -20727,7 +20800,7 @@
|
|||
"version": "10.9.2",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
|
||||
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"dependencies": {
|
||||
"@cspotcode/source-map-support": "^0.8.0",
|
||||
"@tsconfig/node10": "^1.0.7",
|
||||
|
@ -20770,7 +20843,7 @@
|
|||
"version": "8.3.4",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
|
||||
"integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"dependencies": {
|
||||
"acorn": "^8.11.0"
|
||||
},
|
||||
|
@ -20782,7 +20855,7 @@
|
|||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
|
||||
"dev": true
|
||||
"devOptional": true
|
||||
},
|
||||
"node_modules/tsconfig-paths": {
|
||||
"version": "3.15.0",
|
||||
|
@ -21278,7 +21351,7 @@
|
|||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
||||
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
|
||||
"dev": true
|
||||
"devOptional": true
|
||||
},
|
||||
"node_modules/v8-to-istanbul": {
|
||||
"version": "8.1.1",
|
||||
|
@ -22337,7 +22410,7 @@
|
|||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@fingerprintjs/fingerprintjs": "^4.6.2",
|
||||
"@fingerprintjs/fingerprintjs-pro-react": "^2.6.3",
|
||||
"@react-three/csg": "^3.2.0",
|
||||
"@react-three/drei": "^9.113.0",
|
||||
"@react-three/fiber": "^8.17.7",
|
||||
|
|
|
@ -29,6 +29,7 @@ const DashboardHome: React.FC = () => {
|
|||
const fetchRecentProjects = async () => {
|
||||
try {
|
||||
const projects = await recentlyViewed(organization, userId);
|
||||
console.log('RecentlyViewed: ', projects);
|
||||
|
||||
if (JSON.stringify(projects) !== JSON.stringify(recentProjects)) {
|
||||
setRecentProjects(projects);
|
||||
|
|
|
@ -57,7 +57,7 @@ const ZoneProperties: React.FC = () => {
|
|||
};
|
||||
// Call your API to update the zone
|
||||
let response = await zoneCameraUpdate(zonesdata, organization);
|
||||
console.log("response: ", response);
|
||||
// console.log("response: ", response);
|
||||
if (response.message === "updated successfully") {
|
||||
setZones((prevZones: any[]) =>
|
||||
prevZones.map((zone) =>
|
||||
|
|
|
@ -134,7 +134,7 @@ const List: React.FC<ListProps> = ({ items = [], remove }) => {
|
|||
zoneAssetId.id,
|
||||
newName
|
||||
);
|
||||
console.log("response: ", response);
|
||||
// console.log("response: ", response);
|
||||
setFloorItems((prevFloorItems: any[]) =>
|
||||
prevFloorItems.map((floorItems) =>
|
||||
floorItems.modelUuid === zoneAssetId.id
|
||||
|
|
|
@ -174,7 +174,7 @@ const DisplayZone: React.FC<DisplayZoneProps> = ({
|
|||
const email = localStorage.getItem("email") || "";
|
||||
const organization = email?.split("@")[1]?.split(".")[0];
|
||||
let response = await getSelect2dZoneData(zoneId, organization);
|
||||
console.log("response: ", response);
|
||||
// console.log("response: ", response);
|
||||
let res = await getFloatingZoneData(zoneId, organization);
|
||||
console.log("res: ", res);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useState, FormEvent } from "react";
|
||||
import React, { useState, FormEvent, useEffect } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { LogoIconLarge } from "../components/icons/Logo";
|
||||
import { EyeIcon } from "../components/icons/ExportCommonIcons";
|
||||
|
@ -9,6 +9,7 @@ import {
|
|||
} from "../store/builder/store";
|
||||
import { signInApi } from "../services/factoryBuilder/signInSignUp/signInApi";
|
||||
import { signUpApi } from "../services/factoryBuilder/signInSignUp/signUpApi";
|
||||
import FingerprintJS from "@fingerprintjs/fingerprintjs";
|
||||
|
||||
const UserAuth: React.FC = () => {
|
||||
const [email, setEmail] = useState("");
|
||||
|
@ -19,33 +20,62 @@ const UserAuth: React.FC = () => {
|
|||
const { userName, setUserName } = useUserName();
|
||||
const { setOrganization } = useOrganization();
|
||||
const { setLoadingProgress } = useLoadingProgress();
|
||||
const [fingerprint, setFingerprint] = useState("");
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const initializeFingerprint = async () => {
|
||||
const fp = await FingerprintJS.load();
|
||||
const result = await fp.get();
|
||||
setFingerprint(result.visitorId); // Set the fingerprint
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
initializeFingerprint();
|
||||
}, [])
|
||||
|
||||
|
||||
const handleLogin = async (e: FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
|
||||
const organization = email.split("@")[1].split(".")[0];
|
||||
console.log('email, password, organization: ', email, password, organization);
|
||||
|
||||
try {
|
||||
const res = await signInApi(email, password, organization);
|
||||
|
||||
|
||||
if (res.message === "login successfull") {
|
||||
const res = await signInApi(email, password, organization, fingerprint);
|
||||
if (res.message.message === "login successfull") {
|
||||
setError("");
|
||||
setOrganization(organization);
|
||||
setUserName(res.name);
|
||||
console.log(' res.userId: ', res.userId);
|
||||
localStorage.setItem("userId", res.userId);
|
||||
localStorage.setItem("email", res.email);
|
||||
localStorage.setItem("userName", res.name);
|
||||
if (res.isShare) {
|
||||
setUserName(res.message.name);
|
||||
// console.log(' res.userId: ', res.message.userId);
|
||||
localStorage.setItem("userId", res.message.userId);
|
||||
localStorage.setItem("email", res.message.email);
|
||||
localStorage.setItem("userName", res.message.name);
|
||||
localStorage.setItem("token", res.message.token);
|
||||
localStorage.setItem("refreshToken", res.message.refreshToken);
|
||||
|
||||
if (res.message.isShare) {
|
||||
setLoadingProgress(1);
|
||||
// navigate("/Project");
|
||||
navigate("/Dashboard");
|
||||
}
|
||||
} else if (res.message === "User Not Found!!! Kindly signup...") {
|
||||
setError("Account not found");
|
||||
} else if (res.message === "Already LoggedIn on another browser....Please logout!!!") {
|
||||
setError("Already logged in on another browser. Please logout first.");
|
||||
navigate("/");
|
||||
setError("")
|
||||
// setError("");
|
||||
// setOrganization(organization);
|
||||
// setUserName(res.ForceLogoutData.userName);
|
||||
// console.log(' res.userId: ', res.ForceLogoutData.userId);
|
||||
// localStorage.setItem("userId", res.ForceLogoutData.userId);
|
||||
// localStorage.setItem("email", res.ForceLogoutData.Email);
|
||||
// localStorage.setItem("userName", res.ForceLogoutData.userName);
|
||||
// localStorage.setItem("token", res.ForceLogoutData.token);
|
||||
// localStorage.setItem("refreshToken", res.ForceLogoutData.refreshToken);
|
||||
// if (res.ForceLogoutData.isShare) {
|
||||
// setLoadingProgress(1);
|
||||
// navigate("/Dashboard");
|
||||
// }
|
||||
}
|
||||
} catch (error) {
|
||||
echo.error("Login failed");
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
||||
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
|
||||
// let url_Backend_dwinzo = `http://192.168.0.110:5000`;
|
||||
|
||||
export const createProject = async (
|
||||
projectUuid: string,
|
||||
userId: string,
|
||||
thumbnail: string,
|
||||
organization: string
|
||||
) => {
|
||||
|
||||
export const createProject = async (projectUuid: string, userId: string, thumbnail: string, organization: string) => {
|
||||
try {
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/upsertProject`, {
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v2/upsertProject`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>", // Replace with actual token
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
projectUuid,
|
||||
userId,
|
||||
thumbnail,
|
||||
organization,
|
||||
}),
|
||||
body: JSON.stringify({ projectUuid, userId, thumbnail, organization, }),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
|
@ -8,11 +8,14 @@ export const deleteProject = async (
|
|||
) => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1//Project/archive/${projectId}`,
|
||||
`${url_Backend_dwinzo}/api/v2/Project/archive/${projectId}`,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>", // Replace with actual token
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
body: JSON.stringify({ userId, organization }),
|
||||
}
|
||||
|
|
|
@ -3,11 +3,14 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
|
|||
export const getAllProjects = async (userId: string, organization: string) => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1/Projects/${userId}/${organization}`,
|
||||
`${url_Backend_dwinzo}/api/v2/Projects`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>", // Replace with actual token
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
|
|
@ -6,11 +6,14 @@ export const getTrash = async (organization: string) => {
|
|||
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1/Trash/Lists?organization=${organization}`,
|
||||
`${url_Backend_dwinzo}/api/v2/TrashItems`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>", // Replace with actual token
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -20,6 +23,7 @@ export const getTrash = async (organization: string) => {
|
|||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log('TrashItems: ', data);
|
||||
return data;
|
||||
} catch (error: any) {
|
||||
console.error("Failed to fetch trash data:", error);
|
||||
|
|
|
@ -9,7 +9,7 @@ export const projectTutorial = async () => {
|
|||
},
|
||||
});
|
||||
|
||||
console.log("response: ", response);
|
||||
// console.log("response: ", response);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to add project");
|
||||
|
|
|
@ -3,11 +3,14 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
|
|||
export const recentlyViewed = async (organization: string, userId: string) => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1/RecentlyViewed/${userId}/${organization}`,
|
||||
`${url_Backend_dwinzo}/api/v2/RecentlyViewed`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>", // Replace with actual token
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -16,10 +19,10 @@ export const recentlyViewed = async (organization: string, userId: string) => {
|
|||
throw new Error("Failed to fetch project");
|
||||
}
|
||||
|
||||
|
||||
return await response.json();
|
||||
} catch (error: any) {
|
||||
console.error("Failed to get project");
|
||||
throw new Error(error.message);
|
||||
}
|
||||
};
|
||||
|
|
@ -4,11 +4,14 @@ const url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_
|
|||
export const restoreTrash = async (organization: string, projectId: string) => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1/restore?organization=${organization}&projectId=${projectId}`,
|
||||
`${url_Backend_dwinzo}api/v2/Trash/restore?projectId=${projectId}`,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>", // Replace with actual token
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -18,10 +21,10 @@ export const restoreTrash = async (organization: string, projectId: string) => {
|
|||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log('restore: ', data);
|
||||
return data;
|
||||
} catch (error: any) {
|
||||
console.error("Failed to fetch trash data:", error);
|
||||
throw new Error(error.message || "Unknown error");
|
||||
}
|
||||
};
|
||||
|
|
@ -7,11 +7,14 @@ export const searchProject = async (
|
|||
) => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1/searchProjects?organization=${organization}&userId=${userId}&searchName=${searchName}`,
|
||||
`${url_Backend_dwinzo}/api/v2/searchProjects?searchName=${searchName}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>", // Replace with actual token
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -20,9 +23,9 @@ export const searchProject = async (
|
|||
throw new Error("Failed to Search project");
|
||||
}
|
||||
|
||||
console.log("response: ", response);
|
||||
|
||||
const result = await response.json();
|
||||
console.log("result: ", result);
|
||||
console.log("searchProjects: ", result);
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
|
|
|
@ -7,11 +7,14 @@ export const trashSearchProject = async (
|
|||
) => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1/searchTrashProjects?organization=${organization}&userId=${userId}&searchName=${searchName}`,
|
||||
`${url_Backend_dwinzo}/api/v2/searchTrashProjects?searchName=${searchName}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>", // Replace with actual token
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -21,6 +24,7 @@ export const trashSearchProject = async (
|
|||
}
|
||||
|
||||
const result = await response.json();
|
||||
console.log('searchTrashProjects: ', result);
|
||||
return result;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
|
|
|
@ -19,11 +19,14 @@ export const updateProject = async (
|
|||
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1/Project/modify`,
|
||||
`${url_Backend_dwinzo}/api/v2/Project/${projectId}`,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>", // Replace with actual token
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
}
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
||||
|
||||
export const viewProject = async (
|
||||
organization: string,
|
||||
projectId: string,
|
||||
userId: string
|
||||
) => {
|
||||
export const viewProject = async (organization: string,projectId: string,userId: string) => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1/Project/view?organization=${organization}&projectId=${projectId}&userId=${userId}`,
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v2/Project/${projectId}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>", // Replace with actual token
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
|
|
@ -3,9 +3,7 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_MARKETPLACE_URL}
|
|||
export const getAssetImages = async (cursor?: string) => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v3/AssetDatas?limit=10${
|
||||
cursor ? `&cursor=${cursor}` : ""
|
||||
}`,
|
||||
`${url_Backend_dwinzo}/api/v3/AssetDatas?limit=10${cursor ? `&cursor=${cursor}` : ""}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
||||
|
||||
export const signInApi = async (
|
||||
email: string,
|
||||
password: Object,
|
||||
organization: Object
|
||||
) => {
|
||||
export const signInApi = async (Email: string,Password: Object,organization: Object,fingerprint:any) => {
|
||||
try {
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/login`, {
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v2/Auth/login`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ email, password, organization }),
|
||||
headers: {"Content-Type": "application/json",},
|
||||
body: JSON.stringify({ Email, Password, organization,fingerprint}),
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
echo.error("Failed to sign-in");
|
||||
|
|
|
@ -2,17 +2,15 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
|
|||
|
||||
export const signUpApi = async (
|
||||
userName: string,
|
||||
email: string,
|
||||
password: Object,
|
||||
Email: string,
|
||||
Password: Object,
|
||||
organization: Object
|
||||
) => {
|
||||
try {
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/signup`, {
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v2/Auth/signup`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ userName, email, password, organization }),
|
||||
headers: { "Content-Type": "application/json", },
|
||||
body: JSON.stringify({ userName, Email, Password, organization }),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
|
@ -20,7 +18,6 @@ export const signUpApi = async (
|
|||
}
|
||||
|
||||
const result = await response.json();
|
||||
console.log("result: ", result);
|
||||
return result;
|
||||
} catch (error) {
|
||||
echo.error("Failed to sign-up");
|
||||
|
|
Loading…
Reference in New Issue