Skip to content

Commit

Permalink
[BREAK] Do not prefetch shop
Browse files Browse the repository at this point in the history
  • Loading branch information
kmiyashiro committed Oct 8, 2014
1 parent 761bfae commit eb3cb75
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,36 @@ define(function(require) {

$form.find('select').change();

this.preloadShop();
this.showShop();

this.initialized = true;

return this;
},

preloadShop: function() {
loadShop: function() {
// TODO: Support passing slug
var el = $('[data-celery]').first();
var slug = el && $(el).data('celery') || '';

if (slug) {
celeryClient.config.slug = slug;
}

this.fetchShop();
},

fetchShop: function() {
shop.fetch(this.updateOrderSummary);
},

show: function() {
var self = this;

// Load shop data if it wasn't loaded yet
if (!shop.data.user_id) {
this.loadShop();
}

$(document.body).append(this.children);
this.showShop();
// Sets display
this.$overlay.removeClass('u-hidden');
this.$el.removeClass('u-hidden');

Expand All @@ -112,6 +115,7 @@ define(function(require) {
this.$el.addClass('is-hidden');

setTimeout(function() {
// Sets display after 300ms
self.$overlay.addClass('u-hidden');
self.$el.addClass('u-hidden');
self.showShop();
Expand Down

0 comments on commit eb3cb75

Please sign in to comment.