Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Motion Bank
Applications
Systems Frontend
Commits
9dcdca75
Commit
9dcdca75
authored
Oct 31, 2019
by
Anton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not throw when unable to load pba vocabularies
parent
2d4338a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
src/store/modules/vocabularies.js
src/store/modules/vocabularies.js
+9
-3
No files found.
src/store/modules/vocabularies.js
View file @
9dcdca75
...
...
@@ -24,9 +24,15 @@ const vocabularies = {
const
headers
=
{
Authorization
:
`Bearer
${
localStorage
.
getItem
(
'
access_token
'
)}
`
}
const
result
=
await
axios
.
get
(
`
${
process
.
env
.
API_HOST
}
/pba/pieces`
,
{
headers
})
let
pieces
=
result
.
data
.
sort
((
a
,
b
)
=>
a
.
label
.
replace
(
/
\W
/g
,
''
).
localeCompare
(
b
.
label
.
replace
(
/
\W
/g
,
''
)))
if
(
limit
)
pieces
=
pieces
.
splice
(
0
,
limit
)
let
pieces
=
[]
try
{
const
result
=
await
axios
.
get
(
`
${
process
.
env
.
API_HOST
}
/pba/pieces`
,
{
headers
})
pieces
=
result
.
data
.
sort
((
a
,
b
)
=>
a
.
label
.
replace
(
/
\W
/g
,
''
).
localeCompare
(
b
.
label
.
replace
(
/
\W
/g
,
''
)))
if
(
limit
)
pieces
=
pieces
.
splice
(
0
,
limit
)
}
catch
(
err
)
{
console
.
error
(
'
Failed to load PBA vocabularies:
'
,
err
.
message
||
err
.
code
)
}
for
(
let
piece
of
pieces
)
{
const
result
=
await
axios
.
get
(
`
${
process
.
env
.
API_HOST
}
/pba/pieces/
${
piece
.
piece_id
}
/titles`
,
{
headers
})
context
.
commit
(
'
addTermsForScope
'
,
[
piece
.
piece_id
,
result
.
data
.
map
(
title
=>
{
...
...
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