Major refactoring: Add user id to API routes
This commit is contained in:
@@ -45,6 +45,7 @@ const grabHostNames = require("../../package-shared/utils/grab-host-names");
|
||||
* @param {string} params.encryptionKey - Encryption key
|
||||
* @param {string} params.encryptionSalt - Encryption salt
|
||||
* @param {object} [params.additionalFields] - Additional Fields to be added to the user object
|
||||
* @param {boolean} [params.user_id] - User ID
|
||||
*
|
||||
* @returns { Promise<FunctionReturn | undefined> }
|
||||
*/
|
||||
@@ -59,13 +60,15 @@ async function githubAuth({
|
||||
encryptionKey,
|
||||
encryptionSalt,
|
||||
additionalFields,
|
||||
user_id,
|
||||
}) {
|
||||
/**
|
||||
* Check inputs
|
||||
*
|
||||
* @description Check inputs
|
||||
*/
|
||||
const { host, port, scheme } = grabHostNames();
|
||||
const grabedHostNames = grabHostNames();
|
||||
const { host, port, scheme } = grabedHostNames;
|
||||
|
||||
if (!key || key?.match(/ /)) {
|
||||
return {
|
||||
@@ -205,7 +208,9 @@ async function githubAuth({
|
||||
},
|
||||
port,
|
||||
hostname: host,
|
||||
path: `/api/user/github-login`,
|
||||
path: `/api/user/${
|
||||
user_id || grabedHostNames.user_id
|
||||
}/github-login`,
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,6 +43,7 @@ const grabHostNames = require("../../package-shared/utils/grab-host-names");
|
||||
* @param {string} params.encryptionKey - Encryption key
|
||||
* @param {string} params.encryptionSalt - Encryption salt
|
||||
* @param {object} [params.additionalFields] - Additional Fields to be added to the user object
|
||||
* @param {boolean} [params.user_id] - User ID
|
||||
*
|
||||
* @returns { Promise<FunctionReturn> }
|
||||
*/
|
||||
@@ -55,8 +56,10 @@ async function googleAuth({
|
||||
encryptionKey,
|
||||
encryptionSalt,
|
||||
additionalFields,
|
||||
user_id,
|
||||
}) {
|
||||
const { host, port, scheme } = grabHostNames();
|
||||
const grabedHostNames = grabHostNames();
|
||||
const { host, port, scheme } = grabedHostNames;
|
||||
|
||||
/**
|
||||
* Check inputs
|
||||
@@ -201,7 +204,9 @@ async function googleAuth({
|
||||
},
|
||||
port,
|
||||
hostname: host,
|
||||
path: `/api/user/google-login`,
|
||||
path: `/api/user/${
|
||||
user_id || grabedHostNames.user_id
|
||||
}/google-login`,
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user