leaguevine / leaguevine-ultistats

MIT License
18 stars 4 forks source link

Centralize query string parameters #11

Closed cboulay closed 12 years ago

cboulay commented 12 years ago

Currently the season_id parameter is defined the Collection's .url definition. This means that the individual Team.Model's cannot assume the Collection URL. Not being able to use the default collection URL means that we also need logic to define a separate URL for PUT requests.

Also, the access_token is defined in the URL for every module's model and collection. While this is a simple variable and string concatenation, it seems like such a thing would be better if it were centralized.

I propose overriding Backbone.Sync very modestly so that HTTP request query strings are automatically appended with the access_token for all requests and with the season_id for collection get requests.

cboulay commented 12 years ago

Also, the save and delete methods need the following automatically added to the options object. headers: { "Authorization": "bearer " + app.auth.d_token() }

cboulay commented 12 years ago

Tastypie was updated to support such a thing, though he calls it "apikey" instead of "bearer". We could simply rename it. https://github.com/PaulUithol/backbone-tastypie/commit/a2bdb3ffbce920587c5510960341f8a3797a66e3