diff options
author | Michael Foiani <mfoiani2019@communiyschoolnaples.org> | 2018-08-13 16:22:44 -0400 |
---|---|---|
committer | Michael Foiani <mfoiani2019@communiyschoolnaples.org> | 2018-08-13 16:22:44 -0400 |
commit | f14bf1edb18b02359fefb61f6d5f342892f7056c (patch) | |
tree | ffb354db6491f40620bf36f555fbb8f844958935 /src/actions/firebaseFirestore.js | |
parent | 6e8b40c5d78eb6d6cfb3c4d8f2d84b53e55523d0 (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.js | 12 |
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 }); |