fix(auth): github name can be null

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-12-21 09:52:02 +01:00
parent b452eab3af
commit e6ca8a7999

View File

@@ -88,7 +88,7 @@ export async function githubCallback(
const userSchema = z.object({ const userSchema = z.object({
id: z.number(), id: z.number(),
login: z.string(), login: z.string(),
name: z.string(), name: z.string().nullable(),
}); });
const userJson = await userResponse.json(); const userJson = await userResponse.json();
@@ -160,7 +160,7 @@ export async function githubCallback(
const user = await await db.user.create({ const user = await await db.user.create({
data: { data: {
email, email,
firstName: userResult.data.name, firstName: userResult.data.name || userResult.data.login || '',
accounts: { accounts: {
create: { create: {
provider: 'github', provider: 'github',