diff --git a/src/recoup/getArtistSocials.ts b/src/recoup/getArtistSocials.ts index f055c17..ab3e734 100644 --- a/src/recoup/getArtistSocials.ts +++ b/src/recoup/getArtistSocials.ts @@ -1,5 +1,6 @@ import { logger } from "@trigger.dev/sdk/v3"; import { z } from "zod"; +import { NEW_API_BASE_URL, RECOUP_API_KEY } from "../consts"; const artistSocialsResponseSchema = z.object({ status: z.literal("success"), @@ -31,8 +32,6 @@ export type ArtistSocialProfile = z.infer< typeof artistSocialsResponseSchema >["socials"][number]; -const ARTIST_SOCIALS_API_URL = "https://api.recoupable.com/api/artist/socials"; - export async function getArtistSocials( artistAccountId: string ): Promise { @@ -41,14 +40,19 @@ export async function getArtistSocials( return undefined; } + if (!RECOUP_API_KEY) { + logger.error("RECOUP_API_KEY not configured"); + return undefined; + } + try { - const url = new URL(ARTIST_SOCIALS_API_URL); - url.searchParams.set("artist_account_id", artistAccountId); + const url = `${NEW_API_BASE_URL}/api/artists/${artistAccountId}/socials`; - const response = await fetch(url.toString(), { + const response = await fetch(url, { method: "GET", headers: { "Content-Type": "application/json", + "x-api-key": RECOUP_API_KEY, }, });