|
@@ -33,11 +33,11 @@ export default {
|
|
|
console.log('getCorpuses authors data', data)
|
|
|
commit('setAuthors', data.content)
|
|
|
// get the texts list for each corpus (aka author)
|
|
|
- let authorsUuids = []
|
|
|
- for (let author of data.content) {
|
|
|
- authorsUuids.push(author.uuid)
|
|
|
- }
|
|
|
- dispatch('getEditionsList', authorsUuids)
|
|
|
+ // let authorsUuids = []
|
|
|
+ // for (let author of data.content) {
|
|
|
+ // authorsUuids.push(author.uuid)
|
|
|
+ // }
|
|
|
+ dispatch('getEditionsList', data.content)
|
|
|
.then((editionslist) => {
|
|
|
console.log('all texts returned: editionslist', editionslist)
|
|
|
commit('setEditionslist', editionslist)
|
|
@@ -58,16 +58,19 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// get editionslist
|
|
|
- getEditionsList ({ dispatch, commit, state }, authorsUuids) {
|
|
|
- return Promise.all(authorsUuids.map(function (uuid) {
|
|
|
- return REST.get(`/corpus/` + uuid, {})
|
|
|
+ getEditionsList ({ dispatch, commit, state }, authors) {
|
|
|
+ return Promise.all(authors.map(function (author) {
|
|
|
+ return REST.get(`/corpus/` + author.uuid, {})
|
|
|
.then(({ data }) => {
|
|
|
- console.log('corpus getEditionsList REST: data', data)
|
|
|
+ console.log('corpus getEditionsList REST: author, data', author, data)
|
|
|
// work arround
|
|
|
if (!Array.isArray(data.content)) {
|
|
|
data.content = [data.content]
|
|
|
}
|
|
|
- return data
|
|
|
+ return {
|
|
|
+ author: author,
|
|
|
+ editions: data
|
|
|
+ }
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
console.warn('Issue with getEditionsList', error)
|