Skip to content
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

cannot access JSON response data in uploadFiles callback #95

Closed
Leooo opened this issue Sep 3, 2015 · 4 comments
Closed

cannot access JSON response data in uploadFiles callback #95

Leooo opened this issue Sep 3, 2015 · 4 comments

Comments

@Leooo
Copy link

Leooo commented Sep 3, 2015

Hello, I tried to follow #26 and your code to access the json callback of the request, with:

  actions: {
    uploadFiles: function(){
      //$.when(this._super()).then(function(res){
      this._super().then(function(res){
        log("finished");
        log(res);
      });
    }
  }

but this only sends "undefined", like if the response content was not sent in the callback. Can you explain how to access the response content? Thanks

@Leooo Leooo changed the title cannot access JSON response data in uploadAllFiles callback cannot access JSON response data in uploadFiles callback Sep 3, 2015
@Wildhoney
Copy link
Owner

Are you using the latest version? Because Droplet went through a major refactor lately to make it compatible with Ember 2.0.

If you are, use the hooks property:

App.XDropletComponent = Ember.Component.extend($window.Droplet, {
    url: $window.location.origin + '/upload',
    hooks: {
        didUpload: files => console.log(files)
    }
});

@Leooo
Copy link
Author

Leooo commented Sep 3, 2015

Thanks. Yes I'm using the last version - though with Ember 1.12.1 as ember-listview is not ready yet for Ember 2.0. This seems to work alright, except for the issue #91 which prevents overriding the default options - and probably the didUpload hook too (I see nothing logged when customizing the hook for now).

@Leooo
Copy link
Author

Leooo commented Oct 9, 2015

the didUpload hook properly gets the data.files object fetched by the server, though it doesn't recognize this (i.e. the component we are working on), which makes it very hard to work on the data (no access to this.store, this.sendAction etc.). I'm talking mostly here about Ember-cli uses, where we are not supposed to use global App.xx stuff.

@rupurt
Copy link
Contributor

rupurt commented Oct 15, 2015

@Leooo your issue should be fixed in #100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants