Skip to content

Commit

Permalink
fix: generate id for matomo users (#50)
Browse files Browse the repository at this point in the history
* fix: generate id for matomo users

* refactor: the trendy way
  • Loading branch information
matmut7 authored Feb 9, 2022
1 parent 6e2f1de commit d1ba0c3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/services/data-fetchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from "@/utils/env"
import fetcher from "@/utils/fetcher"
import { getJwt } from "@/utils/jwt"
import { randomUUID } from "crypto"
import { gql } from "graphql-request"
import pMap from "p-map"
import { setTimeout } from "timers/promises"
Expand Down Expand Up @@ -94,7 +95,11 @@ export const matomo = async (): Promise<FetchedData> => {
body: `module=API&method=UsersManager.getUsers&format=json&token_auth=${MATOMO_API_TOKEN}`,
}
)
return response.json()
const users: Record<string, unknown>[] = await response.json()
return users.map((user) => ({
...user,
id: randomUUID(),
}))
}

const fetchNextcloudUser = async (login: string) => {
Expand Down

0 comments on commit d1ba0c3

Please sign in to comment.