mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-12-22 19:01:27 +00:00
Adding change password endpoint.
This commit is contained in:
parent
96a6d3ff3f
commit
0ef7f5001c
4 changed files with 18 additions and 3 deletions
|
@ -89,6 +89,7 @@ import {
|
|||
PrivateMessagesResponse,
|
||||
Register,
|
||||
SaveUserSettings,
|
||||
ChangePassword,
|
||||
PersonMentionResponse,
|
||||
} from './interfaces/api/person';
|
||||
|
||||
|
@ -363,6 +364,10 @@ export class LemmyHttp {
|
|||
return this.wrapper(HttpType.Put, '/user/save_user_settings', form);
|
||||
}
|
||||
|
||||
async changePassword(form: ChangePassword): Promise<LoginResponse> {
|
||||
return this.wrapper(HttpType.Put, '/user/change_password', form);
|
||||
}
|
||||
|
||||
async addAdmin(form: AddAdmin): Promise<AddAdminResponse> {
|
||||
return this.wrapper(HttpType.Post, '/admin/add', form);
|
||||
}
|
||||
|
|
|
@ -50,14 +50,18 @@ export interface SaveUserSettings {
|
|||
email?: string;
|
||||
bio?: string;
|
||||
matrix_user_id?: string;
|
||||
new_password?: string; // If setting a new password, you need all 3 password fields
|
||||
new_password_verify?: string;
|
||||
old_password?: string;
|
||||
show_avatars: boolean;
|
||||
send_notifications_to_email: boolean;
|
||||
auth: string;
|
||||
}
|
||||
|
||||
export interface ChangePassword {
|
||||
new_password: string;
|
||||
new_password_verify: string;
|
||||
old_password: string;
|
||||
auth: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The `jwt` string should be stored and used anywhere `auth` is called for.
|
||||
*/
|
||||
|
|
|
@ -63,6 +63,7 @@ export enum UserOperation {
|
|||
SaveSiteConfig,
|
||||
PostJoin,
|
||||
CommunityJoin,
|
||||
ChangePassword,
|
||||
}
|
||||
|
||||
export enum SortType {
|
||||
|
|
|
@ -62,6 +62,7 @@ import {
|
|||
PasswordReset,
|
||||
Register,
|
||||
SaveUserSettings,
|
||||
ChangePassword,
|
||||
} from './interfaces/api/person';
|
||||
import { UserJoin, PostJoin, CommunityJoin } from './interfaces/api/websocket';
|
||||
import { UserOperation } from './interfaces/others';
|
||||
|
@ -272,6 +273,10 @@ export class LemmyWebsocket {
|
|||
return wrapper(UserOperation.SaveUserSettings, form);
|
||||
}
|
||||
|
||||
changePassword(form: ChangePassword) {
|
||||
return wrapper(UserOperation.ChangePassword, form);
|
||||
}
|
||||
|
||||
deleteAccount(form: DeleteAccount) {
|
||||
return wrapper(UserOperation.DeleteAccount, form);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue