This commit is contained in:
Omer Sabic 2024-06-07 17:18:44 +02:00
parent 3871396339
commit 89f44aad7d
3 changed files with 7 additions and 1 deletions

View File

@ -44,7 +44,7 @@ export const sites = pgTable("sites", {
text_color_hex: varchar("text_color_hex", { length: 6 }).default('ffffff').notNull(), text_color_hex: varchar("text_color_hex", { length: 6 }).default('ffffff').notNull(),
title: text("title").default("The best blog in the world!"), title: text("title").default("The best blog in the world!"),
subtitle: text("subtitle").default("Some extra info about the best blog in the world!"), subtitle: text("subtitle").default("Some extra info about the best blog in the world!"),
domain: text("domain").default(null), domain: text("domain").$default(null),
use_freebie: boolean("send_freebie").default(false), use_freebie: boolean("send_freebie").default(false),
freebie_name: text("freebie_name").default(""), freebie_name: text("freebie_name").default(""),
freebie_url: text("freebie_url").default(""), freebie_url: text("freebie_url").default(""),

View File

@ -105,6 +105,9 @@ export const authRoutes = (fastify, _, done) => {
// }); // });
return; return;
} catch (e) { } catch (e) {
if(e.message === "no_channel") {
response.status(400).send("Your account does not have a youtube channel. Please make one.")
}
console.log(e); console.log(e);
response.send({ success: false, message: e.message }); response.send({ success: false, message: e.message });
return; return;

View File

@ -98,6 +98,9 @@ export async function getChannelInfo(access_token) {
maxResults: 1 maxResults: 1
}).then(res => res); }).then(res => res);
if(!channel.data.items[0]) {
throw new Error("no_channel");
}
return channel.data.items[0]; return channel.data.items[0];
} }