adding aws upload to the create post api
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user