diff options
| author | Michael Foiani <mfoiani2019@communiyschoolnaples.org> | 2018-08-13 14:48:13 -0400 |
|---|---|---|
| committer | Michael Foiani <mfoiani2019@communiyschoolnaples.org> | 2018-08-13 14:48:13 -0400 |
| commit | f32d184caca594c71fa7b947ae12ea991b1fc031 (patch) | |
| tree | fa05567ce7fc1bddf317161e91eb00ed90e7c68b /src/actions | |
| parent | 63fc9b25815da079f3559d6b794b57e57db0040f (diff) | |
Created own store for firebaseStorage. Added basic upload method.
Diffstat (limited to 'src/actions')
| -rw-r--r-- | src/actions/firebaseStorage.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/actions/firebaseStorage.js b/src/actions/firebaseStorage.js new file mode 100644 index 0000000..950dfda --- /dev/null +++ b/src/actions/firebaseStorage.js @@ -0,0 +1,15 @@ +import { storage } from '../firebase.js'; + +export const UPLOAD_PICTURE = 'UPLOAD_PICTURE'; + +export const uploadPicture = (picutreFile, uploader) => (dispatch, getState) => { + var storageRef = storage.ref('requests/' + getState().firebaseAuth.uid + '/' + file.name); + + var task = storageRef.put(file); + + task.on('state_changed', function(snapshot) { + var percentage = (snapshot.bytedTransferred / + snapshot.totalBytes) * 100; + uploader.value = percentage; + }); +}
\ No newline at end of file |
