Updates
This commit is contained in:
+16
-25
@@ -9,6 +9,7 @@ import { writeAuthFile } from "../package-shared/functions/backend/auth/write-au
|
||||
import {
|
||||
APILoginFunctionReturn,
|
||||
DSQL_DatabaseSchemaType,
|
||||
PackageUserLoginRequestBody,
|
||||
} from "../package-shared/types";
|
||||
|
||||
type Param = {
|
||||
@@ -32,6 +33,7 @@ type Param = {
|
||||
useLocal?: boolean;
|
||||
skipWriteAuthFile?: boolean;
|
||||
apiUserID?: string | number;
|
||||
dbUserId?: string | number;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -54,6 +56,7 @@ export default async function loginUser({
|
||||
useLocal,
|
||||
apiUserID,
|
||||
skipWriteAuthFile,
|
||||
dbUserId,
|
||||
}: Param): Promise<APILoginFunctionReturn> {
|
||||
const grabedHostNames = grabHostNames();
|
||||
const { host, port, scheme } = grabedHostNames;
|
||||
@@ -148,29 +151,22 @@ export default async function loginUser({
|
||||
email_login_field: emailLoginTempCodeFieldName,
|
||||
token,
|
||||
useLocal,
|
||||
dbUserId,
|
||||
});
|
||||
} else {
|
||||
/**
|
||||
* Make https request
|
||||
*
|
||||
* @description make a request to datasquirel.com
|
||||
*
|
||||
* @type {{ success: boolean, payload: import("../package-shared/types").DATASQUIREL_LoggedInUser | null, userId?: number, msg?: string }}
|
||||
*/
|
||||
httpResponse = await new Promise((resolve, reject) => {
|
||||
/** @type {import("../package-shared/types").PackageUserLoginRequestBody} */
|
||||
const reqPayload: import("../package-shared/types").PackageUserLoginRequestBody =
|
||||
{
|
||||
encryptionKey: finalEncryptionKey,
|
||||
payload,
|
||||
database,
|
||||
additionalFields,
|
||||
email_login,
|
||||
email_login_code,
|
||||
email_login_field: emailLoginTempCodeFieldName,
|
||||
token,
|
||||
skipPassword: skipPassword,
|
||||
};
|
||||
const reqPayload: PackageUserLoginRequestBody = {
|
||||
encryptionKey: finalEncryptionKey,
|
||||
payload,
|
||||
database,
|
||||
additionalFields,
|
||||
email_login,
|
||||
email_login_code,
|
||||
email_login_field: emailLoginTempCodeFieldName,
|
||||
token,
|
||||
skipPassword: skipPassword,
|
||||
dbUserId: dbUserId || 0,
|
||||
};
|
||||
|
||||
const reqPayloadJSON = JSON.stringify(reqPayload);
|
||||
|
||||
@@ -192,11 +188,6 @@ export default async function loginUser({
|
||||
}/login-user`,
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback Function
|
||||
*
|
||||
* @description https request callback
|
||||
*/
|
||||
(res) => {
|
||||
var str = "";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user