From 50013f6340ed748884eebdf9022050c736a737fb Mon Sep 17 00:00:00 2001 From: Michael Fatemi Date: Sat, 10 Apr 2021 15:09:53 -0400 Subject: [PATCH] add registration code --- src/data.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/data.ts b/src/data.ts index d841353..5c081bc 100644 --- a/src/data.ts +++ b/src/data.ts @@ -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 { - 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; }