|
|
|
|
@@ -1,8 +1,10 @@
|
|
|
|
|
import axios from 'axios'
|
|
|
|
|
import storage from '@/storage.js'
|
|
|
|
|
|
|
|
|
|
// const BASE_URL = 'https://api.kevinmidboe.com/api/'
|
|
|
|
|
const BASE_URL = 'http://localhost:31459/api/'
|
|
|
|
|
// const SEASONED_URL = 'https://api.kevinmidboe.com/api/'
|
|
|
|
|
const SEASONED_URL = 'http://localhost:31459/api/'
|
|
|
|
|
|
|
|
|
|
const ELASTIC_URL = 'http://localhost:9200/'
|
|
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
|
// - Move autorization token and errors here?
|
|
|
|
|
@@ -10,7 +12,7 @@ const BASE_URL = 'http://localhost:31459/api/'
|
|
|
|
|
// - - - TMDB - - -
|
|
|
|
|
|
|
|
|
|
const getMovie = (id, credits) => {
|
|
|
|
|
let url = BASE_URL + 'v2/movie/' + id
|
|
|
|
|
let url = SEASONED_URL + 'v2/movie/' + id
|
|
|
|
|
if (credits) {
|
|
|
|
|
url += '?credits=true'
|
|
|
|
|
}
|
|
|
|
|
@@ -20,7 +22,7 @@ const getMovie = (id, credits) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getShow = (id, credits) => {
|
|
|
|
|
let url = BASE_URL + 'v2/show/' + id
|
|
|
|
|
let url = SEASONED_URL + 'v2/show/' + id
|
|
|
|
|
if (credits) {
|
|
|
|
|
url += '?credits=true'
|
|
|
|
|
}
|
|
|
|
|
@@ -29,7 +31,7 @@ const getShow = (id, credits) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getListByName = (listPath, page) => {
|
|
|
|
|
const url = `${BASE_URL}${listPath}?page=${page}`
|
|
|
|
|
const url = `${SEASONED_URL}${listPath}?page=${page}`
|
|
|
|
|
// TODO - remove. this is temporary fix for user-requests endpoint (also import)
|
|
|
|
|
const headers = { authorization: storage.token }
|
|
|
|
|
return axios.get(url, { headers: headers })
|
|
|
|
|
@@ -37,7 +39,7 @@ const getListByName = (listPath, page) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const search = (query, page) => {
|
|
|
|
|
const url = `${BASE_URL}v2/search?query=${query}&page=${page}`
|
|
|
|
|
const url = `${SEASONED_URL}v2/search?query=${query}&page=${page}`
|
|
|
|
|
return axios.get(url)
|
|
|
|
|
.catch(error => { console.error(`api error searching: ${query}, page: ${page}`); throw error })
|
|
|
|
|
}
|
|
|
|
|
@@ -45,7 +47,7 @@ const search = (query, page) => {
|
|
|
|
|
// - - - Torrents - - -
|
|
|
|
|
|
|
|
|
|
const searchTorrents = (query, filter='all', page, authorization_token) => {
|
|
|
|
|
// const url = `${BASE_URL}v1/pirate/search?query=${query}&filter=${filter}&page=${page}`
|
|
|
|
|
// const url = `${SEASONED_URL}v1/pirate/search?query=${query}&filter=${filter}&page=${page}`
|
|
|
|
|
const url = `https://api.kevinmidboe.com/api/v1/pirate/search?query=${query}&filter=${filter}&page=${page}`
|
|
|
|
|
const headers = { authorization: authorization_token }
|
|
|
|
|
return axios.get(url, { headers: headers })
|
|
|
|
|
@@ -55,7 +57,7 @@ const searchTorrents = (query, filter='all', page, authorization_token) => {
|
|
|
|
|
// - - - Plex/Request - - -
|
|
|
|
|
|
|
|
|
|
const request = (id, type, authorization_token) => {
|
|
|
|
|
const url = `${BASE_URL}v1/plex/request/${id}&type=${type}`
|
|
|
|
|
const url = `${SEASONED_URL}v1/plex/request/${id}&type=${type}`
|
|
|
|
|
const headers = { authorization: authorization_token }
|
|
|
|
|
return axios.post(url, { headers: headers })
|
|
|
|
|
.catch(error => { console.error(`api error requesting: ${id}, type: ${type}`); throw error })
|
|
|
|
|
@@ -83,7 +85,7 @@ const plexAuthenticate = (username, password) => {
|
|
|
|
|
// - - - Random emoji - - -
|
|
|
|
|
|
|
|
|
|
const getEmoji = () => {
|
|
|
|
|
const url = `${BASE_URL}v1/emoji`
|
|
|
|
|
const url = `${SEASONED_URL}v1/emoji`
|
|
|
|
|
return axios.get(url)
|
|
|
|
|
.catch(error => { console.log('api error getting emoji'); throw error })
|
|
|
|
|
}
|