fileAPI
parent
b9e6cbca02
commit
9c64445c46
|
@ -31,6 +31,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
page: null,
|
page: null,
|
||||||
|
fileAttached:false,
|
||||||
files: [],
|
files: [],
|
||||||
isLoading: true
|
isLoading: true
|
||||||
}
|
}
|
||||||
|
@ -40,27 +41,18 @@ export default {
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
this.page = data.data
|
this.page = data.data
|
||||||
let attIDs = ''
|
|
||||||
let t = 0
|
|
||||||
this.page[0].attachments.forEach(ids => {
|
|
||||||
if (t == 0) attIDs = ids
|
|
||||||
else attIDs = attIDs + ',' + ids
|
|
||||||
t++
|
|
||||||
// console.log(ids)
|
|
||||||
});
|
|
||||||
// console.log(attIDs)
|
|
||||||
// this.getAttachments(this.page[0].attachments)
|
|
||||||
// console.log(this.page[0].attachments)
|
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
|
|
||||||
fetch('https://api8.siliconpin.com/items/scc22_files_1?filter[id][_in]=' + attIDs)
|
fetch('https://api8.siliconpin.com/items/scc22_files_1?filter[scc22_id][_in]=' + this.page[0].id)
|
||||||
.then(resp => resp.json())
|
.then(resp => resp.json())
|
||||||
.then(file => {
|
.then(file => {
|
||||||
this.files = file.data
|
this.files = file.data
|
||||||
|
this.fileAttached=true
|
||||||
// attach.data.forEach(fileID=> this.files.push(fileID.directus_files_id))
|
// attach.data.forEach(fileID=> this.files.push(fileID.directus_files_id))
|
||||||
console.log(file.data)
|
console.log(file.data)
|
||||||
// this.attachments.push(attach.data[0].directus_files_id)
|
// this.attachments.push(attach.data[0].directus_files_id)
|
||||||
})
|
})
|
||||||
|
if(fileAttached)
|
||||||
// console.log(Object.assign({}, this.files))
|
// console.log(Object.assign({}, this.files))
|
||||||
// console.log(this.files)
|
// console.log(this.files)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue