MCPcopy Index your code
hub / github.com/freeCodeCamp/freeCodeCamp / getToken

Function getToken

client/src/components/settings/exam-token.tsx:26–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24 const { t } = useTranslation();
25
26 const getToken = async () => {
27 try {
28 const response = await generateExamToken();
29
30 const {
31 data: { examEnvironmentAuthorizationToken }
32 } = response;
33 setExamToken(examEnvironmentAuthorizationToken);
34 setExamTokenError('');
35 } catch (_e) {
36 setExamTokenError(t('exam-token.error'));
37 }
38
39 setRecentlyGenerated(true);
40 setTimeout(() => setRecentlyGenerated(false), 10000);
41 };
42
43 const nonStaffTesting =
44 deploymentEnv !== 'production' && !email.endsWith('@freecodecamp.org');

Callers 1

ExamTokenFunction · 0.85

Calls 1

generateExamTokenFunction · 0.90

Tested by

no test coverage detected