{"size": 1176, "ext": "js", "max_stars_repo_path": "cronusw/src/main/public/js/cronus-time.js", "max_stars_repo_name": "codeape/cronus", "max_stars_repo_stars_event_min_datetime": "2017-05-30T21:23:51.000Z", "max_stars_repo_stars_event_max_datetime": "2017-05-30T21:23:51.000Z", "max_issues_repo_path": "cronusw/src/main/public/js/cronus-time.js", "max_issues_repo_name": "codeape/cronus", "max_issues_repo_issues_event_min_datetime": "2016-04-24T19:41:09.000Z", "max_issues_repo_issues_event_max_datetime": "2016-12-31T12:23:53.000Z", "max_forks_repo_path": "cronusw/src/main/public/js/cronus-time.js", "max_forks_repo_name": "codeape/cronus", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 9, "max_forks_count": null, "avg_line_length": 21.0, "max_line_length": 86, "alphanum_fraction": 0.494047619}

define([
  'jquery',
  'underscore',
  'backbone',
  './credentials',
  './loginview'
  ], function(
  $,
  _,
  Backbone,
  Credentials,
  LoginView) {
    console.log("cronus time is on!")

    var Workspace = Backbone.Router.extend({
        routes: {
            "login":    "login",
            "denied":   "denied",
            "register": "register"
        },
        login: function() {
            console.log("Login view loaded")
            new LoginView({model: window.credentials})
        },
        denied: function() {

        },
        register: function() {

        },
    })

    $.ajaxSetup({
        statusCode: {
            401: function(){
                // Redirec the to the login page.
                window.location.replace('/time/#login');

            },
            403: function() { // Maybe we should handle the rest here and not only 403
                // 403 -- Access denied
                window.location.replace('/time/#denied');
            }
        }
    });



    window.credentials = new Credentials()

    var workspace = new Workspace();
    Backbone.history.start()
    workspace.navigate('login', {trigger: true});

});