Skip to content

Commit

Permalink
prettier cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-astra-via committed May 27, 2024
1 parent 732e0ea commit 4b298d1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import UAParser from 'ua-parser-js'

// Get the user ID stored in the client, if it does not exist, then do not set it.
const getUserId = (event: MCEvent): string | null => {
const { client } = event;
let userId = event.payload.user_id || client.get('user_id');
const { client } = event
let userId = event.payload.user_id || client.get('user_id')

Check failure on line 7 in src/index.ts

View workflow job for this annotation

GitHub Actions / build-test (20.x)

'userId' is never reassigned. Use 'const' instead
if (!userId) {
return null;
return null
}
if (event.payload.user_id) {
client.set('user_id', userId, { scope: 'infinite' });
client.set('user_id', userId, { scope: 'infinite' })
}
return userId;
return userId
}

// Get the device ID stored in the client, if it does not exist, make a random one, save it in the client, and return it.
Expand Down Expand Up @@ -55,7 +55,7 @@ export default async function (manager: Manager, settings: ComponentSettings) {
const parsedUserAgent = UAParser(client.userAgent)
const payload = ecomPayload ? ecomPayload : event.payload
// eventData builds the eventData object to be used in the request body
const userId = getUserId(event);
const userId = getUserId(event)

const eventData = {
event_type: pageview ? 'pageview' : payload.event_type,
Expand Down

0 comments on commit 4b298d1

Please sign in to comment.