aboutsummaryrefslogtreecommitdiff
path: root/src/services/ReportingService.ts
diff options
context:
space:
mode:
authorIvan Chen <ivan@thetaggid.com>2020-12-14 19:22:35 -0500
committerGitHub <noreply@github.com>2020-12-14 19:22:35 -0500
commitb5ecbf3e421e9e6f1dbab9f3f851d265ae8470c6 (patch)
tree4c1ee927a851649ef03c8a05619e2d78f2cdb1f4 /src/services/ReportingService.ts
parent3b7bf256d83e1898642c2aab9072ffbeec8cc032 (diff)
[TMA-406&201] User Handle UI for Individual Moments (#129)
* initial work * made big progress towards flatlist moment view * UI done, just need to pass in data now * minor fixes to get things actually running correctly * vertical scroll working * initial index working * moment drawer text color to red * moved report to drawer * removed garbage * added ?
Diffstat (limited to 'src/services/ReportingService.ts')
-rw-r--r--src/services/ReportingService.ts9
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(