30 lines
950 B
TypeScript
30 lines
950 B
TypeScript
import { ResetPasswordParams, UpdateUserFunctionReturn } from "../../types";
|
|
import queryDSQLAPI from "../../functions/api/query-dsql-api";
|
|
import grabUserDSQLAPIPath from "../../utils/backend/users/grab-api-path";
|
|
import apiResetUserPassword from "../../functions/api/users/api-reset-user-password";
|
|
|
|
/**
|
|
* # Reset User Password
|
|
*/
|
|
export default async function resetPassword(
|
|
params: ResetPasswordParams
|
|
): Promise<UpdateUserFunctionReturn> {
|
|
if (params.useLocal) {
|
|
return await apiResetUserPassword(params);
|
|
}
|
|
|
|
const httpResponse = await queryDSQLAPI({
|
|
path: grabUserDSQLAPIPath({
|
|
paradigm: "auth",
|
|
action: "reset-password",
|
|
database: params.database,
|
|
apiVersion: params.apiVersion,
|
|
}),
|
|
apiKey: params.apiKey,
|
|
body: params,
|
|
method: "POST",
|
|
});
|
|
|
|
return httpResponse as UpdateUserFunctionReturn;
|
|
}
|