Skip to content

Commit

Permalink
Issue #233221 fix: take device id from parent app or generate it from…
Browse files Browse the repository at this point in the history
… local
  • Loading branch information
gouravmore committed Jan 13, 2025
1 parent a011e80 commit a1af503
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,16 @@ function App() {
const fp = await FingerprintJS.load();

const { visitorId } = await fp.get();

localStorage.setItem('did', visitorId);
initService();
initService(visitorId);
};
setFp();

const initService = () => {
if (localStorage.getItem('fpDetails_v2') !== null) {
let fpDetails_v2 = localStorage.getItem('fpDetails_v2');
var did = fpDetails_v2.result;
} else {
var did = localStorage.getItem('did');
}

const initService = (visitorId) => {
initialize({
context: {
mode: process.env.REACT_APP_MODE, // To identify preview used by the user to play/edit/preview
authToken: '', // Auth key to make api calls
did: did, // Unique id to identify the device or browser
did: localStorage.getItem("deviceId") || visitorId, // Unique id to identify the device or browser
uid: 'anonymous',
channel: process.env.REACT_APP_CHANNEL, // Unique id of the channel(Channel ID)
env: process.env.REACT_APP_ENV,
Expand Down

0 comments on commit a1af503

Please sign in to comment.