Sha256: 80a5c3d7f31ef8531090f902e0e05b7eef17344ae0ff545395e65a9ace2a4ebc

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 KB

Contents

var Session = Backbone.Model.extend({
		
    setApiKey: function(apiKey) {
        window.sessionStorage.setItem('apiKey', apiKey)
    },	

    setAuthenticated: function(value) {
		window.sessionStorage.setItem('authenticated', value)
	},
	
	getApiKey: function() {
        return window.sessionStorage.getItem('apiKey')
    },	

    getAuthenticated: function() {
		return window.sessionStorage.getItem('authenticated')
	},
	
	reset: function() {
		$(".reset-status")[0].firstChild.className = "label label-warning";
		$(".reset-status")[0].firstChild.innerHTML = "loading...";
		$(".reset-status").css("visibility","visible");
		$.ajax({
			type: 'POST',
			url: '/api/admin/reset',
			data: {api_token : this.getApiKey()},
			success: function(){
				$(".reset-status")[0].firstChild.className = "label label-success";
				$(".reset-status")[0].firstChild.innerHTML = "success";
				//router.navigate("#", true);
			},
			error: function(resp){
				$(".reset-status")[0].firstChild.className = "label label-danger";
				$(".reset-status")[0].firstChild.innerHTML = "error";
				$('#home-alert')[0].innerHTML = resp.responseText;
		        $('#home-alert').css('display','block');
			}
		})
	}
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rhoconnect-3.2.1 lib/rhoconnect/web-console/models/session.js
rhoconnect-3.2.0 lib/rhoconnect/web-console/models/session.js
rhoconnect-3.2.0.beta5 lib/rhoconnect/web-console/models/session.js
rhoconnect-3.2.0.beta4 lib/rhoconnect/web-console/models/session.js
rhoconnect-3.2.0.beta3 lib/rhoconnect/web-console/models/session.js
rhoconnect-3.2.0.beta2 lib/rhoconnect/web-console/models/session.js
rhoconnect-3.2.0.beta1 lib/rhoconnect/web-console/models/session.js