diff --git a/server/utils/trakt.ts b/server/utils/trakt.ts index 8b368ad..1f81704 100644 --- a/server/utils/trakt.ts +++ b/server/utils/trakt.ts @@ -1,14 +1,14 @@ import Trakt from 'trakt.tv'; const traktKeys = useRuntimeConfig().trakt; -if (!traktKeys) { - throw new Error('Missing TraktKeys info ERROR: ' + JSON.stringify(traktKeys)); +let trakt: Trakt | null = null; + +if (traktKeys?.clientId && traktKeys?.clientSecret) { + const options = { + client_id: traktKeys.clientId, + client_secret: traktKeys.clientSecret, + }; + trakt = new Trakt(options); } -const options = { - client_id: traktKeys.clientId, - client_secret: traktKeys.clientSecret, -}; - -const trakt = new Trakt(options); export default trakt;