Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Adicionada foto padrão caso o usuário não escolha #175

Merged
merged 4 commits into from
Jun 2, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions src/Screens/PerfilSettings/perfilsettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ export default class PerfilSettings extends Component {
img: placeHolder[0],
userName: "",
eMail: "",
profileImageUrl: "",
disabled: true,
profileImageUrl:
"https://firebasestorage.googleapis.com/v0/b/unichat-35f13.appspot.com/o/profile-placeholder.png?alt=media&token=2cd02156-cb41-4142-8903-72abac4ddf3c",
disabled: false,
uploading: false
}
this.user = firebase.auth().currentUser
Expand Down Expand Up @@ -89,26 +90,20 @@ export default class PerfilSettings extends Component {
uploadphotos = () => {
const user = firebase.auth().currentUser
const { img } = this.state
this.setState({ uploading: true })
this.setState({ uploading: true, disabled: true })

firebase
.storage()
.ref(`profile_pics/${user.uid}`)
.putFile(img.path)
.on(firebase.storage.TaskEvent.STATE_CHANGED, snapshot => {
let state = {}
state = {
...state
}
if (snapshot.state === firebase.storage.TaskState.SUCCESS) {
state = {
this.setState({
disabled: false,
uploading: false,
profileImageUrl: snapshot.downloadURL
}
})
}

this.setState(state)
})
}

Expand Down