Skip to content

Commit

Permalink
Add user id and class id logging in sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Nov 15, 2024
1 parent d6b3c12 commit 45d00eb
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3153,24 +3153,36 @@ function webViewerPostMessage(evt) {
} else {
({ action, data } = evt.data);
}
const filename = data.name ? `${data.name}.pdf` : "liker-land_ebook.pdf";
const { data: fileData, name, classId, nftId, wallet } = data;
const filename = name ? `${name}.pdf` : "liker-land_ebook.pdf";
const url = `https://liker.land/${filename}`;
switch (action) {
case "openBase64File":
PDFViewerApplication.open({
data: atob(data.data),
data: atob(fileData),
url,
filename,
});
break;
case "openArrayBufferFile":
PDFViewerApplication.open({
data: new Uint8Array(data.data),
data: new Uint8Array(fileData),
url,
filename,
});
break;
}
if (window.Sentry) {
if (wallet) {
window.Sentry.setUser({ id: wallet });
}
if (classId) {
window.Sentry.setTag("classId", classId);
}
if (nftId) {
window.Sentry.setTag("nftId", nftId);
}
}
} catch (ex) {
console.error(`webViewerPostMessage: ${ex}`);
}
Expand Down

0 comments on commit 45d00eb

Please sign in to comment.