add registration code

This commit is contained in:
Michael Fatemi 2021-04-10 15:09:53 -04:00
parent 43edcb5826
commit 50013f6340

View File

@ -1,3 +1,4 @@
import { v4 } from 'uuid';
import { IonProfile } from './auth_ion';
/**
@ -76,5 +77,15 @@ export async function getUserByEmail(
export async function registerUserFromIonProfile(
profile: IonProfile
): Promise<string> {
return 'new_user_0';
const id = v4();
const user: Carpool.User = {
id,
username: profile.ion_username,
email: profile.tj_email,
first_name: profile.first_name,
last_name: profile.last_name,
};
users[id] = user;
console.log('Registered user', user);
return id;
}