-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add image data and path in fb #37
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/ndrsllwngr/omm/fmfjuz4a8 |
lib/useStorage.js
Outdated
useEffect(() => { | ||
// references | ||
const collectionRef = memeFirestore.collection('templates') | ||
const id = collectionRef.doc().id | ||
const storageRef = memeStorage.ref().child('templates').child(id) | ||
const documentData = { | ||
created_at: firebase.firestore.Timestamp.now(), | ||
img: 'templates/' + id, | ||
name: file.name, | ||
} | ||
|
||
storageRef.put(file).on( | ||
'state_changed', | ||
(snap) => { | ||
let percentage = (snap.bytesTransferred / snap.totalBytes) * 100 | ||
setProgress(percentage) | ||
console.log('precentage:', percentage) | ||
console.log('document:', documentData) | ||
}, | ||
(err) => { | ||
setError(err) | ||
console.log(err) | ||
}, | ||
async () => { | ||
const url = await storageRef.getDownloadURL() | ||
await collectionRef.add({ documentData }) | ||
setUrl(url) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, reference the source of the code 😄
bug with gallery: continuous rerender - needs to be fixed
screenshot not fully functional yet
missing snap function
No description provided.