aboutsummaryrefslogtreecommitdiff
path: root/src/actions/firebaseFirestore.js
diff options
context:
space:
mode:
authorMichael Foiani <mfoiani2019@communiyschoolnaples.org>2018-08-13 16:22:44 -0400
committerMichael Foiani <mfoiani2019@communiyschoolnaples.org>2018-08-13 16:22:44 -0400
commitf14bf1edb18b02359fefb61f6d5f342892f7056c (patch)
treeffb354db6491f40620bf36f555fbb8f844958935 /src/actions/firebaseFirestore.js
parent6e8b40c5d78eb6d6cfb3c4d8f2d84b53e55523d0 (diff)
Trying to find ways to get img in firebase storage to show in admin panel when viewing requests.
Diffstat (limited to 'src/actions/firebaseFirestore.js')
-rw-r--r--src/actions/firebaseFirestore.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/actions/firebaseFirestore.js b/src/actions/firebaseFirestore.js
index 3efeb6a..789d9d3 100644
--- a/src/actions/firebaseFirestore.js
+++ b/src/actions/firebaseFirestore.js
@@ -1,4 +1,4 @@
-import { firestore } from '../firebase.js';
+import { firestore, storage } from '../firebase.js';
export const UPDATE_DIVISON = 'UPDATE_DIVISON';
export const UPDATE_HOURS = 'UPDATE_HOURS';
@@ -104,13 +104,21 @@ export const requestHours = (_time, _trainee, _location, _subject, _date, _pictu
var docRef = firestore.collection('requests');
const _uid = getState().firebaseAuth.uid;
const _email = getState().firebaseAuth.userEmail;
+ var _imgPath = "";
+
+ var storageRef = storage.ref().child('requests/' + _uid + '/' + _pictureName);
+ storageRef.getDownloadURL().then((url) => {
+ _imgPath = url;
+ });
+
+
docRef.add({
time: _time,
trainee: _trainee,
location: _location,
subject: _subject,
day: _date,
- picture: _pictureName,
+ imgPath: _imgPath,
uid: _uid,
email: _email
});