This commit is contained in:
lesion 2022-01-21 11:51:10 +01:00
parent 8a8c6ac951
commit b3226f75b3
4 changed files with 7 additions and 7 deletions

View file

@ -44,7 +44,7 @@ export default {
async fetch() { async fetch() {
console.error('dentro fetch') console.error('dentro fetch')
console.error(this.cohort) console.error(this.cohort)
this.posts = await this.$http.$get(`/api/cohort/${this.cohort.id}`, this.posts = await this.$http.$get(`${process.env.baseUrl}/api/cohort/${this.cohort.id}`,
{ params: { maxPosts: this.maxPosts }}) { params: { maxPosts: this.maxPosts }})
// console.error(res) // console.error(res)
// .then(res => res.json()) // .then(res => res.json())

View file

@ -43,7 +43,7 @@ export default {
] ]
}), }),
async fetch () { async fetch () {
this.sources = await this.$http.$get('/api/source') this.sources = await this.$http.$get(`${process.env.baseUrl}/api/source`)
}, },
methods: { methods: {
copy (ev, item) { copy (ev, item) {
@ -72,7 +72,7 @@ export default {
// se e' un feed valido, lo aggiungo ai sources e all cohort appena creata // se e' un feed valido, lo aggiungo ai sources e all cohort appena creata
// se non e' valido provo a cercare il feed dentro quell'url // se non e' valido provo a cercare il feed dentro quell'url
try { try {
const source = await this.$http.$post('/api/source', { URL: this.url }) const source = await this.$http.$post(`${process.env.baseUrl}/api/source`, { URL: this.url })
this.sources.unshift( source ) this.sources.unshift( source )
// this.$emit('addCohort', { id: 1, title: this.title }) // this.$emit('addCohort', { id: 1, title: this.title })
// this.url = '' // this.url = ''

View file

@ -62,7 +62,7 @@ export default {
methods: { methods: {
async makeSearch () { async makeSearch () {
this.loading = true this.loading = true
this.sources = await this.$http.$get(`/api/source/search?search=${encodeURIComponent(this.search)}`) this.sources = await this.$http.$get(`${process.env.baseUrl}/api/source/search?search=${encodeURIComponent(this.search)}`)
this.loading = false this.loading = false
}, },
} }

View file

@ -92,7 +92,7 @@ export default {
}), }),
async fetch() { async fetch() {
// const lastPosts = await fetch('http://localhost:3000/api/posts').then(res => res.json()) // const lastPosts = await fetch('http://localhost:3000/api/posts').then(res => res.json())
this.cohorts = await this.$http.$get('/api/cohorts') this.cohorts = await this.$http.$get(`${process.env.baseUrl}/api/cohorts`)
}, },
watch: { watch: {
async search (value) { async search (value) {
@ -103,11 +103,11 @@ export default {
methods: { methods: {
async makeSearch () { async makeSearch () {
this.loading = true this.loading = true
this.sources = await this.$http.$get(`/api/source/search?search=${encodeURIComponent(this.search)}`) this.sources = await this.$http.$get(`${process.env.baseUrl}/api/source/search?search=${encodeURIComponent(this.search)}`)
this.loading = false this.loading = false
}, },
async addCohort () { async addCohort () {
const cohort = await this.$http.$post('/api/cohort', { ...this.cohort, sources: this.cohortSources.map(s => s.id) }) const cohort = await this.$http.$post(`${process.env.baseUrl}/api/cohort`, { ...this.cohort, sources: this.cohortSources.map(s => s.id) })
this.cohorts.unshift(cohort) this.cohorts.unshift(cohort)
this.cohort = {} this.cohort = {}
}, },