fix(auth): github name can be null
This commit is contained in:
@@ -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',
|
||||||
|
|||||||
Reference in New Issue
Block a user