aboutsummaryrefslogtreecommitdiff
path: root/src/screens
diff options
context:
space:
mode:
authorGeorge Rusu <george@tagg.id>2021-05-21 15:57:00 -0700
committerGeorge Rusu <george@tagg.id>2021-05-21 15:57:00 -0700
commit768c826897d8988f5e91456f213a836a7ba59f4b (patch)
tree8e3dadc5507546085a4a3037e478d8ac99b88a50 /src/screens
parent87333873c8e47bccd99198a974a40df57619df22 (diff)
Fetch momentTag objects from the backend
Diffstat (limited to 'src/screens')
-rw-r--r--src/screens/profile/IndividualMoment.tsx23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/screens/profile/IndividualMoment.tsx b/src/screens/profile/IndividualMoment.tsx
index 515cbacf..f7eb9c96 100644
--- a/src/screens/profile/IndividualMoment.tsx
+++ b/src/screens/profile/IndividualMoment.tsx
@@ -1,9 +1,12 @@
+import AsyncStorage from '@react-native-community/async-storage';
import {BlurView} from '@react-native-community/blur';
import {RouteProp} from '@react-navigation/native';
import {StackNavigationProp} from '@react-navigation/stack';
import React from 'react';
-import {FlatList, StyleSheet, View} from 'react-native';
+import {Alert, FlatList, StyleSheet, View} from 'react-native';
import {useSelector} from 'react-redux';
+import {MOMENT_TAGS_ENDPOINT} from 'src/constants/api';
+import {ERROR_SOMETHING_WENT_WRONG_REFRESH} from 'src/constants/strings';
import {
IndividualMomentTitleBar,
MomentPostContent,
@@ -54,6 +57,24 @@ const IndividualMoment: React.FC<IndividualMomentProps> = ({
);
const initialIndex = momentData.findIndex((m) => m.moment_id === moment_id);
+ const loadMomentTags = async () => {
+ try {
+ const token = await AsyncStorage.getItem('token');
+ const response = await fetch(MOMENT_TAGS_ENDPOINT + `/${moment_id}/`, {
+ method: 'GET',
+ headers: {
+ Authorization: 'Token ' + token,
+ },
+ });
+ const status = response.status;
+ if (status === 201) {
+ //create TaggDraggables with
+ }
+ } catch (error) {
+ Alert.alert(ERROR_SOMETHING_WENT_WRONG_REFRESH);
+ }
+ };
+
const renderMomentPost = ({item}: {item: MomentType}) => (
<View style={styles.postContainer}>
<MomentPostHeader