Skip to content
Snippets Groups Projects
Commit c5689784 authored by Ulung32's avatar Ulung32
Browse files

register jwt

parent cab92a90
No related merge requests found
......@@ -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) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment