@prass/botpress-native
Version:
A simple and powerful SDK for integrating Botpress Chat API with React Native,
31 lines (28 loc) • 938 B
JavaScript
import { prepareHeaders } from '../../utils/prepareHeaders.js';
import { handleError } from '../../utils/errorHandler.js';
/**
* Internal handler for deleting the current authenticated user.
* @param this - Botpress instance context
* @returns Promise resolving to void upon successful deletion
* @throws Error if user key is missing or API call fails
*/
async function handleDeleteUser() {
if (!this.userKey)
throw new Error(this.errors.userNotCreated);
try {
const url = this.ChatApiBaseUrl.getUrl(["users", "me"]);
await this.axiosInstance.request({
url,
method: "DELETE",
headers: prepareHeaders({
"x-user-key": this.userKey,
}),
timeout: this.config.timeout,
});
}
catch (err) {
return handleError(err, "DeleteUser");
}
}
export { handleDeleteUser };
//# sourceMappingURL=deleteUser.js.map