11import axios from 'axios'
22import * as Sentry from '@sentry/node'
33import { JAMI_URL , API_TOKEN , inProduction } from './common.js'
4- import { access } from 'fs'
5- import { KeyboardDoubleArrowLeftRounded } from '@mui/icons-material'
64import { ProgrammeLevel } from '@/shared/lib/enums.js'
5+ import logger from './logger.js'
76
87interface Faculty {
98 readonly code : string
@@ -91,7 +90,7 @@ export const getIamAccess = async (iamGroups: string[], attempt = 1): Promise<Ac
9190 return { specialGroup, access : { ...lomakeAccess , ...access } }
9291 } catch ( error : any ) {
9392 if ( attempt > 3 ) {
94- console . log ( '[Jami] error: ' , error )
93+ logger . error ( '[Jami] error: ' , error )
9594 Sentry . captureException ( error )
9695
9796 return { }
@@ -107,19 +106,19 @@ export const getOrganisationData = async (): Promise<Faculty[]> => {
107106 return data
108107}
109108
110- export const getJoryMapFromJami = async ( ) => {
109+ export const getJoryMapFromJami = async ( ) : Promise < Record < string , string | string [ ] > > => {
111110 const { data } = await jamiClient . get ( '/jory-map' )
112111 return data
113112}
114113
115114export const testJami = async ( ) => {
116115 try {
117116 await jamiClient . get ( '/ping' , { timeout : 4000 } )
118- console . log ( 'JAMI connected' )
117+ logger . info ( 'JAMI connected' )
119118 } catch ( error ) {
120- console . log ( error )
121- console . log ( JAMI_URL )
122- console . log ( 'JAMI not responding :(' )
123- console . log ( 'Are you sure you are using the latest JAMI image?' )
119+ logger . error ( error )
120+ logger . error ( JAMI_URL )
121+ logger . error ( 'JAMI not responding :(' )
122+ logger . error ( 'Are you sure you are using the latest JAMI image?' )
124123 }
125124}
0 commit comments