diff options
author | Ashm Walia <ashmwalia@outlook.com> | 2021-02-04 00:55:07 -0800 |
---|---|---|
committer | Ashm Walia <ashmwalia@outlook.com> | 2021-02-04 00:55:07 -0800 |
commit | 6335532f33fa74229881a3eb0b66c2ebcb076c76 (patch) | |
tree | 486f0d1d76a09fd039b4edfa06267b6747ff9726 | |
parent | 607e0204ab1a8b2d91a96ba58abb34423bcbfcca (diff) |
Sc
-rw-r--r-- | src/services/MomentService.ts | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/src/services/MomentService.ts b/src/services/MomentService.ts index 514ca776..2354d18e 100644 --- a/src/services/MomentService.ts +++ b/src/services/MomentService.ts @@ -1,7 +1,7 @@ import AsyncStorage from '@react-native-community/async-storage'; import RNFetchBlob from 'rn-fetch-blob'; import {MOMENTS_ENDPOINT, MOMENT_THUMBNAIL_ENDPOINT} from '../constants'; -import {MomentType, MomentWithUserType} from '../types'; +import {MomentType} from '../types'; import {checkImageUploadStatus} from '../utils'; export const postMoment: ( @@ -78,33 +78,6 @@ export const loadMoments: ( return moments; }; -export const loadSingleMoment: ( - momentId: string, - token: string, -) => Promise<MomentWithUserType | undefined> = async (momentId, token) => { - let moment: MomentWithUserType; - try { - const response = await fetch(MOMENTS_ENDPOINT + `${momentId}/`, { - method: 'GET', - headers: { - Authorization: 'Token ' + token, - }, - }); - const status = response.status; - if (status === 200) { - const data = await response.json(); - moment = data; - } else { - console.log('Could not load moments!'); - return undefined; - } - } catch (err) { - console.log(err); - return undefined; - } - return moment; -}; - export const deleteMoment = async (momentId: string) => { try { const token = await AsyncStorage.getItem('token'); |