mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-12-23 11:21: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,
|
PrivateMessagesResponse,
|
||||||
Register,
|
Register,
|
||||||
SaveUserSettings,
|
SaveUserSettings,
|
||||||
|
ChangePassword,
|
||||||
PersonMentionResponse,
|
PersonMentionResponse,
|
||||||
} from './interfaces/api/person';
|
} from './interfaces/api/person';
|
||||||
|
|
||||||
|
@ -363,6 +364,10 @@ export class LemmyHttp {
|
||||||
return this.wrapper(HttpType.Put, '/user/save_user_settings', form);
|
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> {
|
async addAdmin(form: AddAdmin): Promise<AddAdminResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/admin/add', form);
|
return this.wrapper(HttpType.Post, '/admin/add', form);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,14 +50,18 @@ export interface SaveUserSettings {
|
||||||
email?: string;
|
email?: string;
|
||||||
bio?: string;
|
bio?: string;
|
||||||
matrix_user_id?: 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;
|
show_avatars: boolean;
|
||||||
send_notifications_to_email: boolean;
|
send_notifications_to_email: boolean;
|
||||||
auth: string;
|
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.
|
* The `jwt` string should be stored and used anywhere `auth` is called for.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -63,6 +63,7 @@ export enum UserOperation {
|
||||||
SaveSiteConfig,
|
SaveSiteConfig,
|
||||||
PostJoin,
|
PostJoin,
|
||||||
CommunityJoin,
|
CommunityJoin,
|
||||||
|
ChangePassword,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SortType {
|
export enum SortType {
|
||||||
|
|
|
@ -62,6 +62,7 @@ import {
|
||||||
PasswordReset,
|
PasswordReset,
|
||||||
Register,
|
Register,
|
||||||
SaveUserSettings,
|
SaveUserSettings,
|
||||||
|
ChangePassword,
|
||||||
} from './interfaces/api/person';
|
} from './interfaces/api/person';
|
||||||
import { UserJoin, PostJoin, CommunityJoin } from './interfaces/api/websocket';
|
import { UserJoin, PostJoin, CommunityJoin } from './interfaces/api/websocket';
|
||||||
import { UserOperation } from './interfaces/others';
|
import { UserOperation } from './interfaces/others';
|
||||||
|
@ -272,6 +273,10 @@ export class LemmyWebsocket {
|
||||||
return wrapper(UserOperation.SaveUserSettings, form);
|
return wrapper(UserOperation.SaveUserSettings, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changePassword(form: ChangePassword) {
|
||||||
|
return wrapper(UserOperation.ChangePassword, form);
|
||||||
|
}
|
||||||
|
|
||||||
deleteAccount(form: DeleteAccount) {
|
deleteAccount(form: DeleteAccount) {
|
||||||
return wrapper(UserOperation.DeleteAccount, form);
|
return wrapper(UserOperation.DeleteAccount, form);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue