mirror of
https://github.com/KevinMidboe/seasoned.git
synced 2026-03-11 11:55:38 +00:00
Renamed seasonedAPI to api.js
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import storage from '@/storage.js'
|
import storage from '@/storage.js'
|
||||||
|
|
||||||
// const BASE_URL = 'https://api.kevinmidboe.com/api/'
|
// const SEASONED_URL = 'https://api.kevinmidboe.com/api/'
|
||||||
const BASE_URL = 'http://localhost:31459/api/'
|
const SEASONED_URL = 'http://localhost:31459/api/'
|
||||||
|
|
||||||
|
const ELASTIC_URL = 'http://localhost:9200/'
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// - Move autorization token and errors here?
|
// - Move autorization token and errors here?
|
||||||
@@ -10,7 +12,7 @@ const BASE_URL = 'http://localhost:31459/api/'
|
|||||||
// - - - TMDB - - -
|
// - - - TMDB - - -
|
||||||
|
|
||||||
const getMovie = (id, credits) => {
|
const getMovie = (id, credits) => {
|
||||||
let url = BASE_URL + 'v2/movie/' + id
|
let url = SEASONED_URL + 'v2/movie/' + id
|
||||||
if (credits) {
|
if (credits) {
|
||||||
url += '?credits=true'
|
url += '?credits=true'
|
||||||
}
|
}
|
||||||
@@ -20,7 +22,7 @@ const getMovie = (id, credits) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getShow = (id, credits) => {
|
const getShow = (id, credits) => {
|
||||||
let url = BASE_URL + 'v2/show/' + id
|
let url = SEASONED_URL + 'v2/show/' + id
|
||||||
if (credits) {
|
if (credits) {
|
||||||
url += '?credits=true'
|
url += '?credits=true'
|
||||||
}
|
}
|
||||||
@@ -29,7 +31,7 @@ const getShow = (id, credits) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getListByName = (listPath, page) => {
|
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)
|
// TODO - remove. this is temporary fix for user-requests endpoint (also import)
|
||||||
const headers = { authorization: storage.token }
|
const headers = { authorization: storage.token }
|
||||||
return axios.get(url, { headers: headers })
|
return axios.get(url, { headers: headers })
|
||||||
@@ -37,7 +39,7 @@ const getListByName = (listPath, page) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const search = (query, 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)
|
return axios.get(url)
|
||||||
.catch(error => { console.error(`api error searching: ${query}, page: ${page}`); throw error })
|
.catch(error => { console.error(`api error searching: ${query}, page: ${page}`); throw error })
|
||||||
}
|
}
|
||||||
@@ -45,7 +47,7 @@ const search = (query, page) => {
|
|||||||
// - - - Torrents - - -
|
// - - - Torrents - - -
|
||||||
|
|
||||||
const searchTorrents = (query, filter='all', page, authorization_token) => {
|
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 url = `https://api.kevinmidboe.com/api/v1/pirate/search?query=${query}&filter=${filter}&page=${page}`
|
||||||
const headers = { authorization: authorization_token }
|
const headers = { authorization: authorization_token }
|
||||||
return axios.get(url, { headers: headers })
|
return axios.get(url, { headers: headers })
|
||||||
@@ -55,7 +57,7 @@ const searchTorrents = (query, filter='all', page, authorization_token) => {
|
|||||||
// - - - Plex/Request - - -
|
// - - - Plex/Request - - -
|
||||||
|
|
||||||
const request = (id, type, authorization_token) => {
|
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 }
|
const headers = { authorization: authorization_token }
|
||||||
return axios.post(url, { headers: headers })
|
return axios.post(url, { headers: headers })
|
||||||
.catch(error => { console.error(`api error requesting: ${id}, type: ${type}`); throw error })
|
.catch(error => { console.error(`api error requesting: ${id}, type: ${type}`); throw error })
|
||||||
@@ -83,7 +85,7 @@ const plexAuthenticate = (username, password) => {
|
|||||||
// - - - Random emoji - - -
|
// - - - Random emoji - - -
|
||||||
|
|
||||||
const getEmoji = () => {
|
const getEmoji = () => {
|
||||||
const url = `${BASE_URL}v1/emoji`
|
const url = `${SEASONED_URL}v1/emoji`
|
||||||
return axios.get(url)
|
return axios.get(url)
|
||||||
.catch(error => { console.log('api error getting emoji'); throw error })
|
.catch(error => { console.log('api error getting emoji'); throw error })
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ import Person from './Person.vue'
|
|||||||
|
|
||||||
import LoadingPlaceholder from './ui/LoadingPlaceholder.vue'
|
import LoadingPlaceholder from './ui/LoadingPlaceholder.vue'
|
||||||
|
|
||||||
import { getMovie, getShow, request } from '../seasonedAPI.js'
|
import { getMovie, getShow, request } from '@/api.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['id', 'type'],
|
props: ['id', 'type'],
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import MoviesListItem from './MoviesListItem.vue'
|
|||||||
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
|
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
|
||||||
import LoadingPlaceholder from '@/components/ui/LoadingPlaceholder.vue'
|
import LoadingPlaceholder from '@/components/ui/LoadingPlaceholder.vue'
|
||||||
import Loader from '@/components/ui/Loader.vue'
|
import Loader from '@/components/ui/Loader.vue'
|
||||||
import { search, getListByName } from '../seasonedAPI'
|
import { search, getListByName } from '@/api.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import MoviesList from './MoviesList.vue'
|
|||||||
import Settings from './Settings.vue'
|
import Settings from './Settings.vue'
|
||||||
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
|
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
|
||||||
|
|
||||||
import { getEmoji } from '@/seasonedAPI.js'
|
import { getEmoji } from '@/api.js'
|
||||||
// import CreatedLists from './CreatedLists.vue'
|
// import CreatedLists from './CreatedLists.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ import storage from '../storage.js'
|
|||||||
import SeasonedInput from '@/components/ui/SeasonedInput.vue'
|
import SeasonedInput from '@/components/ui/SeasonedInput.vue'
|
||||||
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
|
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
|
||||||
|
|
||||||
import { plexAuthenticate } from '@/seasonedAPI.js'
|
import { plexAuthenticate } from '@/api.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { SeasonedInput, SeasonedButton },
|
components: { SeasonedInput, SeasonedButton },
|
||||||
|
|||||||
Reference in New Issue
Block a user