-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Legger på kall til IA-metrikker etter fem sekunder på alle undersider * Fjerner alle andre kall til Ia-metrikkene * Skriver tester for metrikkutsendelser
- Loading branch information
Showing
20 changed files
with
135 additions
and
475 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { useEffect } from "react"; | ||
import { sendDigitalIaTjenesteMetrikk } from "../integrasjoner/ia-tjenestemetrikker-api"; | ||
import { useOrgnr } from "./useOrgnr"; | ||
|
||
export function useSendIaMetrikkEtterFemSekunder() { | ||
const orgnr = useOrgnr(); | ||
|
||
useEffect(() => { | ||
const timer = setTimeout(() => { | ||
sendDigitalIaTjenesteMetrikk(orgnr); | ||
}, 5000); | ||
return () => clearTimeout(timer); | ||
}, [orgnr]); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,31 @@ | ||
import { METRIKKER_URL } from "../utils/konstanter"; | ||
import { | ||
MetrikkKilde, | ||
MetrikkType, | ||
sendIaMetrikk, | ||
} from "@navikt/ia-metrikker-client"; | ||
import { AUTHENTICATED_BASE_PATH } from "../utils/konstanter"; | ||
|
||
export const sendDigitalIaTjenesteMetrikk = async ( | ||
tjeneste: MetrikkKilde, | ||
orgnr?: string | ||
) => { | ||
if (!orgnr) { | ||
return Promise.reject("orgnr er udefinert"); | ||
} | ||
return sendIaMetrikk( | ||
orgnr, | ||
MetrikkType.DIGITAL_IA_TJENESTE, | ||
tjeneste, | ||
METRIKKER_URL | ||
); | ||
}; | ||
interface Metrikk { | ||
orgnr: string; | ||
type: string; | ||
kilde: string; | ||
} | ||
|
||
export const sendIaMetrikkInteraksjonstjeneste = async (tjeneste: MetrikkKilde, orgnr?: string) => { | ||
const METRIKKER_URL = AUTHENTICATED_BASE_PATH + "/metrikker"; | ||
|
||
export const sendDigitalIaTjenesteMetrikk = async (orgnr?: string) => { | ||
if (!orgnr) { | ||
return Promise.reject("orgnr er udefinert"); | ||
} | ||
return sendIaMetrikk( | ||
orgnr, | ||
MetrikkType.INTERAKSJONSTJENESTE, | ||
tjeneste, | ||
METRIKKER_URL | ||
); | ||
|
||
const metrikk: Metrikk = { | ||
orgnr: orgnr, | ||
type: "DIGITAL_IA_TJENESTE", | ||
kilde: "FOREBYGGE_FRAVÆR", | ||
}; | ||
|
||
return await fetch(METRIKKER_URL, { | ||
method: "POST", | ||
credentials: "include", | ||
body: JSON.stringify(metrikk), | ||
headers: { | ||
Accept: "application/json", | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.