Renamed seasonedAPI to api.js

This commit is contained in:
2019-06-04 22:34:05 +02:00
parent df33e2408a
commit 7f38f7f0cd
5 changed files with 15 additions and 13 deletions

View File

@@ -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 })
}

View File

@@ -129,7 +129,7 @@ import Person from './Person.vue'
import LoadingPlaceholder from './ui/LoadingPlaceholder.vue'
import { getMovie, getShow, request } from '../seasonedAPI.js'
import { getMovie, getShow, request } from '@/api.js'
export default {
props: ['id', 'type'],

View File

@@ -45,7 +45,7 @@ import MoviesListItem from './MoviesListItem.vue'
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
import LoadingPlaceholder from '@/components/ui/LoadingPlaceholder.vue'
import Loader from '@/components/ui/Loader.vue'
import { search, getListByName } from '../seasonedAPI'
import { search, getListByName } from '@/api.js'
export default {
props: {

View File

@@ -33,7 +33,7 @@ import MoviesList from './MoviesList.vue'
import Settings from './Settings.vue'
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
import { getEmoji } from '@/seasonedAPI.js'
import { getEmoji } from '@/api.js'
// import CreatedLists from './CreatedLists.vue'
export default {

View File

@@ -46,7 +46,7 @@ import storage from '../storage.js'
import SeasonedInput from '@/components/ui/SeasonedInput.vue'
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
import { plexAuthenticate } from '@/seasonedAPI.js'
import { plexAuthenticate } from '@/api.js'
export default {
components: { SeasonedInput, SeasonedButton },