aboutsummaryrefslogtreecommitdiff
path: root/src
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
parent87333873c8e47bccd99198a974a40df57619df22 (diff)
Fetch momentTag objects from the backend
Diffstat (limited to 'src')
-rw-r--r--src/constants/api.ts1
-rw-r--r--src/screens/profile/IndividualMoment.tsx23
2 files changed, 23 insertions, 1 deletions
diff --git a/src/constants/api.ts b/src/constants/api.ts
index 6cc357f5..d52fc203 100644
--- a/src/constants/api.ts
+++ b/src/constants/api.ts
@@ -31,6 +31,7 @@ export const SEARCH_ENDPOINT: string = API_URL + 'search/';
export const SEARCH_ENDPOINT_MESSAGES: string = API_URL + 'search/messages/';
export const SEARCH_ENDPOINT_SUGGESTED: string = API_URL + 'search/suggested/';
export const MOMENTS_ENDPOINT: string = API_URL + 'moments/';
+export const MOMENT_TAGS_ENDPOINT: string = API_URL + 'moments/tags/';
export const MOMENT_THUMBNAIL_ENDPOINT: string = API_URL + 'moment-thumbnail/';
export const VERIFY_INVITATION_CODE_ENDPOUNT: string = API_URL + 'verify-code/';
export const COMMENTS_ENDPOINT: string = API_URL + 'comments/';
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