feat: get image from tmdb

This commit is contained in:
2023-07-31 17:21:17 +02:00
parent 79975905d1
commit 3a5c5b4404
12 changed files with 148 additions and 29 deletions

View File

@ -21,7 +21,7 @@ export const menus: Record<string, Menu> = {
state.activeState.value = "loading";
const movie = context as Movie;
let query = movie.name;
const query = movie.name;
// if (movie.meta.author) {
// query += movie.meta.author;
@ -31,8 +31,6 @@ export const menus: Record<string, Menu> = {
`/api/tmdb/query?q=${encodeURIComponent(query)}`,
);
console.log(response);
const json = await response.json() as TMDBMovie[];
const menuID = `result/${movie.name}`;
@ -43,7 +41,10 @@ export const menus: Record<string, Menu> = {
title: `${m.title} released ${m.release_date}`,
cb: async () => {
state.activeState.value = "loading";
const res = await fetch(`/api/tmdb/${m.id}`);
const res = await fetch(`/api/movies/${movie.name}/`, {
method: "POST",
body: JSON.stringify({ tmdbId: m.id }),
});
const j = await res.json();
console.log("Selected", { movie, m, j });
state.visible.value = false;