mirror of https://github.com/portainer/portainer
35 lines
961 B
JavaScript
35 lines
961 B
JavaScript
angular.module('portainer.services')
|
|
.factory('EndpointProvider', ['LocalStorage', function EndpointProviderFactory(LocalStorage) {
|
|
'use strict';
|
|
var endpoint = {};
|
|
var service = {};
|
|
service.initialize = function() {
|
|
var endpointID = LocalStorage.getEndpointID();
|
|
var endpointPublicURL = LocalStorage.getEndpointPublicURL();
|
|
if (endpointID) {
|
|
endpoint.ID = endpointID;
|
|
}
|
|
if (endpointPublicURL) {
|
|
endpoint.PublicURL = endpointPublicURL;
|
|
}
|
|
};
|
|
service.clean = function() {
|
|
endpoint = {};
|
|
};
|
|
service.endpointID = function() {
|
|
return endpoint.ID;
|
|
};
|
|
service.setEndpointID = function(id) {
|
|
endpoint.ID = id;
|
|
LocalStorage.storeEndpointID(id);
|
|
};
|
|
service.endpointPublicURL = function() {
|
|
return endpoint.PublicURL;
|
|
}
|
|
service.setEndpointPublicURL = function(publicURL) {
|
|
endpoint.PublicURL = publicURL;
|
|
LocalStorage.storeEndpointPublicURL(publicURL);
|
|
}
|
|
return service;
|
|
}]);
|