Last active
February 27, 2018 04:36
-
-
Save afrontend/70fabb3b737bdf3ac0f6e50ec66c4cd1 to your computer and use it in GitHub Desktop.
dlserver app에서 사용하는 web api 접근을 위한 AngularJS 서비스 코드의 일부
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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