mirror of
https://github.com/KeyZox71/knl_meowscendence.git
synced 2026-01-01 06:06:41 +01:00
Merge remote-tracking branch 'origin/main' into user-management
This commit is contained in:
24
src/utils/authUserCreate.js
Normal file
24
src/utils/authUserCreate.js
Normal file
@ -0,0 +1,24 @@
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* @param {string} username
|
||||
* @param {import('fastify').FastifyInstance} fastify
|
||||
*/
|
||||
export async function authUserCreate(username, fastify) {
|
||||
const payload = {
|
||||
displayName: username,
|
||||
};
|
||||
const cookie = fastify.jwt.sign({ user: "admin" });
|
||||
|
||||
const url = process.env.USER_URL || "http://localhost:3002/"
|
||||
|
||||
await axios.post(
|
||||
url + "users/" + username,
|
||||
payload,
|
||||
{
|
||||
headers: {
|
||||
'Cookie': 'token=' + cookie,
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user