From f8b5819c7770060a2a79236c43a199883cbc6c17 Mon Sep 17 00:00:00 2001
From: Ibaliqbal
Date: Thu, 11 Jul 2024 15:13:42 +0700
Subject: [PATCH] imgae service is not worikng
---
astro.config.mjs | 4 +-
src/pages/favorite/index.astro | 9 +++-
src/pages/movie/[id]/index.astro | 56 +++++++++++++----------
src/pages/signin.astro | 4 ++
src/pages/tv/[id]/index.astro | 76 +++++++++++++++++++++++++-------
5 files changed, 106 insertions(+), 43 deletions(-)
diff --git a/astro.config.mjs b/astro.config.mjs
index d966868..0855bc7 100644
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -31,7 +31,5 @@ export default defineConfig({
},
integrations: [tailwind(), react(), auth()],
output: "server",
- adapter: vercel({
- imageService: true,
- }),
+ adapter: vercel(),
});
diff --git a/src/pages/favorite/index.astro b/src/pages/favorite/index.astro
index b186cc3..6711407 100644
--- a/src/pages/favorite/index.astro
+++ b/src/pages/favorite/index.astro
@@ -1,11 +1,18 @@
---
-import Layout from "@/layouts/Layout.astro";
import { user } from "@/store";
import { getFavorite } from "@/lib/supabase/function";
import NavLink from "@/components/ui/NavLink.astro";
import Link from "@/components/ui/Link.astro";
import { Image } from "astro:assets";
import { format } from "date-fns";
+import { getSession } from "auth-astro/server";
+import Layout from "@/layouts/Layout.astro";
+
+const { request, redirect } = Astro;
+
+const session = await getSession(request);
+
+if (!session) return redirect("/");
export const prerender = false;
diff --git a/src/pages/movie/[id]/index.astro b/src/pages/movie/[id]/index.astro
index 92de566..9e42a51 100644
--- a/src/pages/movie/[id]/index.astro
+++ b/src/pages/movie/[id]/index.astro
@@ -91,15 +91,21 @@ const movies = similarMovies.results.filter(
)
}
-
- Website :
- {data.homepage}
-
+ {
+ data.homepage && (
+
+ Website :
+
+ {data.homepage}
+
+
+ )
+ }
Budget : {" "}
@@ -131,20 +137,24 @@ const movies = similarMovies.results.filter(
-
- Compilation / Trailer Video
-
- {
- videoCompilation.map((video) => (
-
-
-
- ))
- }
-
-
+ {
+ videoCompilation.length > 0 ? (
+
+ Compilation / Trailer Video
+
+ {videoCompilation.map((video) => (
+
+
+
+ ))}
+
+
+ ) : null
+ }
Credits
diff --git a/src/pages/tv/[id]/index.astro b/src/pages/tv/[id]/index.astro
index f288c5c..5460655 100644
--- a/src/pages/tv/[id]/index.astro
+++ b/src/pages/tv/[id]/index.astro
@@ -2,18 +2,26 @@
import DetailLayout from "@/layouts/DetailLayout.astro";
import { Image } from "astro:assets";
import type { Tv } from "@/types/tv";
-import { getDetail, getSimiliarDatas, getVideoCompilation } from "@/utils/data";
+import {
+ getDetail,
+ getSimiliarDatas,
+ getVideoCompilation,
+ getCredits,
+} from "@/utils/data";
import Link from "@/components/ui/Link.astro";
import LikeAction from "@/components/React/LikeAction";
import { format } from "date-fns";
import { FaStar } from "react-icons/fa";
import Card from "@/components/Tv/Card.astro";
import { user } from "@/store";
+import { YouTube } from "@astro-community/astro-embed-youtube";
export const prerender = false;
const { id } = Astro.params;
+const urlImage = import.meta.env.PUBLIC_TMDB_IMG_URL;
+
const videoCompilation = (await getVideoCompilation(
"tv",
id as string
@@ -21,6 +29,8 @@ const videoCompilation = (await getVideoCompilation(
const similarShows = await getSimiliarDatas("tv", id as string, 1);
+const credits = await getCredits(id as string, "tv");
+
const shows = similarShows.results?.filter(
(movie: Tv) =>
typeof movie.poster_path === "string" &&
@@ -41,7 +51,7 @@ const data = (await getDetail("tv", (id as string) ?? "")) as DetailTv;
-
- Website :
- {data.homepage}
-
+ {
+ data.homepage && (
+
+ Website :
+
+ {data.homepage}
+
+
+ )
+ }
Total Eps : {data.number_of_episodes} / {data.episode_run_time[0]} minutes
@@ -106,12 +122,10 @@ const data = (await getDetail("tv", (id as string) ?? "")) as DetailTv;
{videoCompilation.map((video) => (
-
))}
@@ -119,6 +133,36 @@ const data = (await getDetail("tv", (id as string) ?? "")) as DetailTv;
) : null
}
+ {
+ credits.length > 0 ? (
+
+ Credits
+
+ {credits.map((credit) => (
+
+ {credit.profile_path === null ? (
+
+ Photo not found
+
+ ) : (
+
+ )}
+
+
{`${credit.name} ( ${credit.original_name} )`}
+
{credit.character}
+
+
+ ))}
+
+
+ ) : null
+ }