mirror of
https://github.com/KevinMidboe/seasoned.git
synced 2026-03-11 03:49:07 +00:00
Re-wrote most all api calls to use fetch over axios. There is still a problem with form authentication with plex. The response we get does not seem to be a json object. Updated what is expected to return from altered api methods in each component that uses them
This commit is contained in:
@@ -146,8 +146,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
parseResponse(resp) {
|
||||
let movie = resp.data;
|
||||
parseResponse(movie) {
|
||||
this.movie = { ...movie }
|
||||
this.title = movie.title
|
||||
this.poster = movie.poster
|
||||
|
||||
@@ -54,9 +54,7 @@ export default {
|
||||
searchTmdb(query, page)
|
||||
.then(this.parseResponse)
|
||||
},
|
||||
parseResponse(response) {
|
||||
const data = response.data
|
||||
|
||||
parseResponse(data) {
|
||||
if (this.results.length > 0) {
|
||||
this.results.push(...data.results)
|
||||
} else {
|
||||
|
||||
@@ -104,7 +104,7 @@ export default {
|
||||
|
||||
elasticSearchMoviesAndShows(this.query)
|
||||
.then(resp => {
|
||||
const data = resp.data.hits.hits
|
||||
const data = resp.hits.hits
|
||||
|
||||
this.elasticSearchResults = data.map(item => {
|
||||
const index = item._index.slice(0, -1)
|
||||
|
||||
@@ -75,12 +75,15 @@ export default {
|
||||
let password = this.plexPassword
|
||||
|
||||
plexAuthenticate(username, password)
|
||||
.then((resp) => {
|
||||
let data = resp.data;
|
||||
.then(resp => {
|
||||
const data = resp.data
|
||||
this.messages.push({ type: 'success', title: 'Authenticated with plex', message: 'Successfully linked plex account with seasoned request' })
|
||||
// console.log('response from plex:', data.user)
|
||||
|
||||
console.log('response from plex:', data.username)
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
|
||||
this.messages.push({ type: 'error', title: 'Something went wrong', message: error.message })
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user