diff options
Diffstat (limited to 'src/services/ReportingService.ts')
-rw-r--r-- | src/services/ReportingService.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/services/ReportingService.ts b/src/services/ReportingService.ts index 2650a703..1563d086 100644 --- a/src/services/ReportingService.ts +++ b/src/services/ReportingService.ts @@ -2,14 +2,15 @@ import {REPORT_ISSUE_ENDPOINT} from '../constants'; import {Alert} from 'react-native'; +import AsyncStorage from '@react-native-community/async-storage'; export const sendReport = async ( moment_id: string, message: string, - token: string, - callback: Function, + callback?: Function, ) => { try { + let token = await AsyncStorage.getItem('token'); let response = await fetch(REPORT_ISSUE_ENDPOINT, { method: 'POST', body: JSON.stringify({ @@ -28,7 +29,9 @@ export const sendReport = async ( } else { Alert.alert('Something went wrong!', 'Please try again.'); } - callback(false); + if (callback) { + callback(); + } } catch (error) { Alert.alert('Something went wrong!', 'Please try again.'); console.log( |