Skip to content

Commit

Permalink
Refactor analytics API
Browse files Browse the repository at this point in the history
  • Loading branch information
nkshah2 committed Oct 9, 2023
1 parent e70667a commit d896dc5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/build/recipe/dashboard/api/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const normalisedURLPath_1 = __importDefault(require("../../../normalisedURLPath"
const version_1 = require("../../../version");
const error_1 = __importDefault(require("../../../error"));
const cross_fetch_1 = __importDefault(require("cross-fetch"));
const utils_1 = require("../../../utils");
async function analyticsPost(_, ___, options, __) {
// If telemetry is disabled, dont send any event
if (!supertokens_1.default.getInstanceOrThrowError().telemetryEnabled) {
Expand Down Expand Up @@ -64,7 +65,7 @@ async function analyticsPost(_, ___, options, __) {
const data = {
websiteDomain: websiteDomain({
request: undefined,
userContext: {},
userContext: utils_1.makeDefaultUserContextFromAPI(options.req),
}).getAsStringDangerous(),
apiDomain: apiDomain.getAsStringDangerous(),
appName,
Expand Down
3 changes: 2 additions & 1 deletion lib/ts/recipe/dashboard/api/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import NormalisedURLPath from "../../../normalisedURLPath";
import { version as SDKVersion } from "../../../version";
import STError from "../../../error";
import fetch from "cross-fetch";
import { makeDefaultUserContextFromAPI } from "../../../utils";

export type Response = {
status: "OK";
Expand Down Expand Up @@ -75,7 +76,7 @@ export default async function analyticsPost(
const data = {
websiteDomain: websiteDomain({
request: undefined,
userContext: {},
userContext: makeDefaultUserContextFromAPI(options.req),
}).getAsStringDangerous(),
apiDomain: apiDomain.getAsStringDangerous(),
appName,
Expand Down

0 comments on commit d896dc5

Please sign in to comment.