mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 20:15:24 +00:00
16 lines
455 B
TypeScript
16 lines
455 B
TypeScript
import axios from 'axios';
|
|
import type {MediaItemResponse} from "@/api/interfaces";
|
|
|
|
const BASE_URL = 'http://127.0.0.1:8000/api'
|
|
|
|
function get(url: string): Promise<any> {
|
|
return axios.get(`${BASE_URL}${url}`)
|
|
.then(response => response.data)
|
|
.catch(error => {
|
|
throw error;
|
|
});
|
|
}
|
|
|
|
export default function search(query: string, type: string) : Promise<MediaItemResponse> {
|
|
return get(`/search?search_terms=${query}&type=${type}`)
|
|
} |