Commit 9dcdca75 authored by Anton's avatar Anton

Do not throw when unable to load pba vocabularies

parent 2d4338a8
......@@ -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 => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment