adding aws upload to the create post api

This commit is contained in:
Will Baumbach
2025-07-26 13:06:35 -05:00
parent 2704577d39
commit 54e960eaf6
8 changed files with 663 additions and 12 deletions

View File

@@ -10,11 +10,23 @@ export default function App() {
async function _takePhoto() {
if (cameraRef.current) {
const pic = await cameraRef.current.takePictureAsync()
setPhoto(pic.uri);
console.debug(photo)
setPhoto(pic.base64 || '');
console.log(pic);
}
}
async function sendData() {
const response = await fetch("localhost:3000/api/v1/posts", {
method: "POST",
body: JSON.stringify({
user: '6883ddb2640ebaa1a12e3791',
date: new Date(),
photo: photo,
notes: '3333 W Smoochie St'
}),
}).then(() => {console.log(response)});
}
if (!permission) {
// Camera permissions are still loading.
return <View />;
@@ -39,7 +51,7 @@ export default function App() {
<TouchableOpacity style={styles.button} onPress={() => setPhoto('')}>
<Text style={styles.text}>Retake</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.button} onPress={_takePhoto}>
<TouchableOpacity style={styles.button} onPress={sendData}>
<Text style={styles.text}>Continue</Text>
</TouchableOpacity>
</View>