From 7f38f7f0cdeebcb05af9966053a35b94ffd09c67 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 4 Jun 2019 22:34:05 +0200 Subject: [PATCH] Renamed seasonedAPI to api.js --- src/{seasonedAPI.js => api.js} | 20 +++++++++++--------- src/components/Movie.vue | 2 +- src/components/MoviesList.vue | 2 +- src/components/Profile.vue | 2 +- src/components/Settings.vue | 2 +- 5 files changed, 15 insertions(+), 13 deletions(-) rename src/{seasonedAPI.js => api.js} (82%) diff --git a/src/seasonedAPI.js b/src/api.js similarity index 82% rename from src/seasonedAPI.js rename to src/api.js index cefb0d4..d342525 100644 --- a/src/seasonedAPI.js +++ b/src/api.js @@ -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 }) } diff --git a/src/components/Movie.vue b/src/components/Movie.vue index 8a66ba7..8514eba 100644 --- a/src/components/Movie.vue +++ b/src/components/Movie.vue @@ -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'], diff --git a/src/components/MoviesList.vue b/src/components/MoviesList.vue index 6156935..30fce20 100644 --- a/src/components/MoviesList.vue +++ b/src/components/MoviesList.vue @@ -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: { diff --git a/src/components/Profile.vue b/src/components/Profile.vue index 03e9d36..87fa8d7 100644 --- a/src/components/Profile.vue +++ b/src/components/Profile.vue @@ -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 { diff --git a/src/components/Settings.vue b/src/components/Settings.vue index f6e303c..565e74b 100644 --- a/src/components/Settings.vue +++ b/src/components/Settings.vue @@ -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 },