Hi, I have a problem when wanting files to firebase, it sends me the following error, I do not understand why it tells me to add in mirage / config, I do not use that.
assert.js: 36 Mirage: Your Ember app tried to POST ' link *** * .appspot.com / or? name = images% 2Fbacul-advertisement.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?
This is my component where I have the logic to upload 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">
{{input type="text" value=item.name class="form-control" placeholder="Nombre de autor"}}
</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>
{{x-file-input alt="hello world" accept="image/png,image/jpg" action=(action "didSelectImage")}}
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default" {{action 'click_btn_save' item}} disabled="{{if item.isNotValid 'disabled'}}">{{btn_label}}</button>
</div>
</div>
</div>
Any help or suggestion? I do not know what the problem is.