aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/screens/profile/CaptionScreen.tsx20
-rw-r--r--src/services/MomentService.ts5
-rw-r--r--src/types/types.ts1
3 files changed, 10 insertions, 16 deletions
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx
index 1b96face..d53570cb 100644
--- a/src/screens/profile/CaptionScreen.tsx
+++ b/src/screens/profile/CaptionScreen.tsx
@@ -147,19 +147,13 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
// separate upload logic for image/video
if (isMediaAVideo) {
const presignedURL = await handlePresignedURL(mediaFilename, title);
- // TOOD: ignoring type error for PoC reason
- const response: {
- response_msg: string;
- response_url: string;
- moment_id: string;
- } = handleVideoUpload(
- {
- filename: mediaFilename,
- sourceURL: mediaUri,
- },
- presignedURL,
- );
- momentId = response.moment_id;
+ if (!presignedURL) {
+ handleFailed();
+ return;
+ }
+ momentId = presignedURL.moment_id;
+ // TODO: assume success for now
+ await handleVideoUpload(mediaFilename, mediaUri, presignedURL);
} else {
const momentResponse = await postMoment(
mediaFilename,
diff --git a/src/services/MomentService.ts b/src/services/MomentService.ts
index da1bfb97..ca32a3f3 100644
--- a/src/services/MomentService.ts
+++ b/src/services/MomentService.ts
@@ -311,7 +311,7 @@ export const handleVideoUpload = async (
// let data = await response.json();
if (status === 200 || status === 204) {
console.log('complete');
- return response;
+ return true;
} else {
if (status === 404) {
console.log(
@@ -323,11 +323,10 @@ export const handleVideoUpload = async (
console.log(ERROR_SOMETHING_WENT_WRONG_REFRESH);
}
console.log(response);
- return false;
}
} catch (error) {
console.log(error);
console.log(ERROR_SOMETHING_WENT_WRONG);
- return false;
}
+ return false;
};
diff --git a/src/types/types.ts b/src/types/types.ts
index f6f23fc8..416d9146 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -379,4 +379,5 @@ export type PresignedURLResponse = {
'x-amz-signature': string;
};
};
+ moment_id: string;
};