Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Motion Bank
Services
Motion Bank API
Commits
5a0309ba
Commit
5a0309ba
authored
Oct 31, 2019
by
Anton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not perform pba vocabulary requests if not configured
parent
0ac37aba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
src/lib/pba.js
src/lib/pba.js
+8
-4
No files found.
src/lib/pba.js
View file @
5a0309ba
...
...
@@ -15,18 +15,22 @@ class PBA extends TinyEmitter {
}
async
_performRequest
(
path
)
{
if
(
config
.
pba
.
baseUrl
)
{
const
result
=
await
axios
.
get
(
`
${
config
.
pba
.
baseUrl
}
/
${
path
}
`
,
{
auth
:
config
.
pba
.
credentials
})
return
result
.
data
}
}
async
getPiecesHandler
(
req
,
res
)
{
const
result
=
await
this
.
_performRequest
(
'
pieces
'
)
this
.
_response
(
req
,
res
,
result
.
pieces
)
if
(
result
)
this
.
_response
(
req
,
res
,
result
.
pieces
)
else
this
.
_errorResponse
({},
503
,
'
PBA vocabularies not available
'
)
}
async
getTitlesForPieceHandler
(
req
,
res
)
{
const
result
=
await
this
.
_performRequest
(
`titles/
${
req
.
params
.
piece_id
}
`
)
this
.
_response
(
req
,
res
,
result
.
titles
)
if
(
result
)
this
.
_response
(
req
,
res
,
result
.
titles
)
else
this
.
_errorResponse
({},
503
,
'
PBA vocabularies not available
'
)
}
_response
(
req
,
res
,
data
=
{})
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment