diff --git a/src/handler/user/user.service.ts b/src/handler/user/user.service.ts index ebbf9077b94faa55e14385d87b8816e2e58a3203..3d5d442de1e9a43440fdd1aaa942bfcc99095a8c 100644 --- a/src/handler/user/user.service.ts +++ b/src/handler/user/user.service.ts @@ -51,11 +51,22 @@ export async function register(user : User) { password : user.password, } }) - responseString = "success"; + const payLoad = { + id: result.id, + name: result.name, + username: result.username, + } + + const Secret = process.env.JWT_SECRET!; + + const expiresIn = 60*60*24; + const token = jwt.sign(payLoad, Secret, {expiresIn: expiresIn}) + return token; }catch (err) { responseString = "failed"; + return responseString; } - return responseString; + } export async function login(username : string, password : string) {