diff --git a/api/utils/getuser.js b/api/utils/getuser.js index 92d147d..c73a18b 100644 --- a/api/utils/getuser.js +++ b/api/utils/getuser.js @@ -33,8 +33,8 @@ class User { getSettingsOrDefaults() { const settings = this.getSettings() - for (const key of Object.keys(settings)) { - if (settings[key] === null) settings[key] = constants.user_settings[key].default + for (const key of Object.keys(constants.user_settings)) { + if (settings[key] == null) settings[key] = constants.user_settings[key].default } return settings } diff --git a/api/utils/youtube.js b/api/utils/youtube.js index 2a41467..dcee701 100644 --- a/api/utils/youtube.js +++ b/api/utils/youtube.js @@ -2,6 +2,7 @@ const fetch = require("node-fetch") const db = require("./db") async function fetchChannel(ucid, instance) { + if (!instance) throw new Error("No instance parameter provided") // fetch const channel = await fetch(`${instance}/api/v1/channels/${ucid}`).then(res => res.json()) // update database