Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김서영
/
searchGuide
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김서영
2019-11-23 15:02:07 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
72d2a5f1957f03acdcf8acbd71eea5a44704e642
72d2a5f1
1 parent
6f1813cc
api try catch/ add header to api request
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
api/apiRequest.js
api/apiRequest.js
View file @
72d2a5f
...
...
@@ -37,13 +37,22 @@ apiRequest.ETRI = async ( query, argument ) => {
return
new
Promise
(
(
resolve
,
reject
)
=>
{
let
apiReqJson
=
apiRequestJsonFrame
;
apiReqJson
.
argument
=
argument
;
let
apiReqOption
=
{
uri
:
URL
.
ETRI
+
query
,
body
:
JSON
.
stringify
(
apiReqJson
)
};
let
apiReqOption
=
{
headers
:
{
"Accept"
:
"application/json"
,
"Content-Type"
:
"application/json"
,
},
uri
:
URL
.
ETRI
+
query
,
body
:
JSON
.
stringify
(
apiReqJson
)
};
rp
.
post
(
apiReqOption
)
.
then
(
(
body
)
=>
{
body
=
JSON
.
parse
(
body
);
if
(
body
.
result
==
"-1"
)
{
throw
new
Error
(
body
.
reason
);
}
resolve
(
body
);
})
.
catch
(
(
err
)
=>
{
throw
new
Error
(
err
);
});
})
}
...
...
Please
register
or
login
to post a comment