🐛 (fix) handle user name not found
Handle users who do not have a name by entering the login field as the username field to prevent errors in the GitHub provision account process.
This commit is contained in:
@ -32,15 +32,15 @@ interface GithubUserData {
|
||||
type: string;
|
||||
user_view_type: string;
|
||||
site_admin: boolean;
|
||||
name: string;
|
||||
company: null;
|
||||
blog: string;
|
||||
location: string;
|
||||
email: null;
|
||||
hireable: null;
|
||||
bio: string;
|
||||
twitter_username: null;
|
||||
notification_email: null;
|
||||
name?: string;
|
||||
company?: string;
|
||||
blog?: string;
|
||||
location?: string;
|
||||
email?: string;
|
||||
hireable?: boolean;
|
||||
bio?: string;
|
||||
twitter_username?: string;
|
||||
notification_email?: string;
|
||||
public_repos: number;
|
||||
public_gists: number;
|
||||
followers: number;
|
||||
@ -52,5 +52,5 @@ interface GithubUserEmail {
|
||||
email: string;
|
||||
primary: boolean;
|
||||
verified: boolean;
|
||||
visibility: null | string;
|
||||
visibility?: string;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ export const githubCallbackService = async (
|
||||
userPayload.user_email.find((email) => email.primary === true)
|
||||
?.email || userPayload.user_email[0].email,
|
||||
username: `git_${userPayload.user_data.id}`,
|
||||
name: userPayload.user_data.name,
|
||||
name: userPayload.user_data.name ?? userPayload.user_data.login,
|
||||
avatar: userPayload.user_data.avatar_url,
|
||||
password: Math.random()
|
||||
.toString(36)
|
||||
|
||||
Reference in New Issue
Block a user