I have a problem at the moment of wanting files to firebase I throw the following error, I do not understand because it tells me to add in mirage / config I do not use that.
assert.js:36 Mirage: Your Ember app tried to POST 'http://ift.tt/2fuL4GX****http://.appspot.com/o?name=images%2Fbacul-anuncio.png', but there was no route defined to handle this request. Define a route that matches this path in your mirage/config.js file. Did you forget to add your namespace? este es mi componente donde tengo la logica de subir los datos a firebase
This is my component where I have the logic to upload the data to firebase
import Ember from 'ember';
export default Ember.Component.extend({
/*
Esto es para subir imagenes declaramos algunas variables
*/
firebaseApp: Ember.inject.service(),
storageRef:'',
file: '',
/* Fin */
btn_label:'Guardar',
actions:{
click_btn_save(param){
// create metadata
var metadata={
contentType: 'image/png'
};
var storageRef=this.get('firebaseApp').storage().ref();
var path='images/' + this.get('file').name;
var uploadTask = storageRef.child(path).put(this.get('file'), metadata);
//var uploadTask=storageRef.child(path).put(this.get('file'), metadata);
uploadTask.on('state_changed', function(snapshot){
var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
console.log('Upload is ' + progress + '% done');
console.log(snapshot.state);
}, function(error) {
console.log("Ocurrio un errore ");
console.log(error);
}, function() {
console.log("entro a buen recaudo");
var downloadURL = uploadTask.snapshot.downloadURL;
//newPlan.set('imageUrl', downloadURL);
//newPlan.save().then(() => ctrl.transitionToRoute('plans'));
/* ctrl.set('file', '');
ctrl.set('selectedCategory', '');
ctrl.set(document.getElementById('output').src, '');
ctrl.set('days', '');
ctrl.set('isDisabled', true);
*/
});
this.sendAction('action',param)
},
didSelectImage(files){
let reader=new FileReader();
reader.onloadend= Ember.run.bind(this,function(){
console.log("Entro todo bien funciona");
var dataUrl=reader.result;
var output= document.getElementById('output');
output.src=dataUrl;
this.set('file', files[0]);
});
reader.readAsDataURL(files[0]);
}
}
});
this is my template
<!-- app/templates/components/library-item-form.hbs -->
<div class="form-horizontal">
<div class="form-group">
<div class="col-sm-12 col-md-3">
</div>
<div class="col-md-3">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Image<br>(200x200)</label>
<div class="col-sm-10">
<img id="output" height="200" width="200">
<p></p>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default" disabled=""></button>
</div>
</div>
</div>
Any help or suggestion? I do not know what the problem is
Aucun commentaire:
Enregistrer un commentaire