Skip to content

Instantly share code, notes, and snippets.

@afrontend
Last active February 27, 2018 04:36
Show Gist options
  • Save afrontend/70fabb3b737bdf3ac0f6e50ec66c4cd1 to your computer and use it in GitHub Desktop.
Save afrontend/70fabb3b737bdf3ac0f6e50ec66c4cd1 to your computer and use it in GitHub Desktop.
dlserver app에서 사용하는 web api 접근을 위한 AngularJS 서비스 코드의 일부
function getLibraryNames(callback) {
$http({
method: 'GET',
url: '/libraryList'
}).then(function successCallback(response) {
if(callback) {
callback(response.data);
}
}, function errorCallback(response) {
$log.log('status: ' + response.status);
$log.log('statusText: ' + response.statusText);
}
);
}
function getLibrary(option, callback) {
$http({
method: 'GET',
url: '/',
timeout: 30000,
params: {
title: option.title,
libraryName: option.libraryName
}
}).then(function successCallback(response) {
if(callback) {
callback(null, response.data);
}
}, function errorCallback(response) {
if(response.status === -1) {
callback({
msg: '검색에 실패했습니다.'
}, response.data);
}
$log.log('status: ' + response.status);
$log.log('statusText: ' + response.statusText);
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment