Don't start routing before servers has been loaded

This commit is contained in:
Björn Dahlgren 2015-08-24 00:45:35 +02:00
parent 12cab35055
commit e4d42d4b2a
2 changed files with 7 additions and 1 deletions

View File

@ -39,5 +39,4 @@ require.config({
require(['jquery', 'bootstrap', 'backbone', 'app/router'], function ($, Bootstrap, Backbone, Router) {
var router = new Router();
Backbone.history.start();
});

View File

@ -37,12 +37,19 @@ define(function (require) {
sweetAlertInitialize();
missions.fetch();
var initialized = false;
var socket = io.connect();
socket.on('mods', function (_mods) {
mods.set(_mods);
});
socket.on('servers', function (_servers) {
servers.set(_servers);
if (!initialized) {
initialized = true;
Backbone.history.start();
}
});
},