Francesco Grazioso 6de526c356 start
2024-06-01 11:36:51 +02:00

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