| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import FetchRequest from "@/api/FetchRequest";
- import type User from "@/mode/User";
- import type setUser from "@/mode/setUser";
- /**
- * 用户接口
- */
- class UserApi {
- static url = "/api/sys/users";
- static getUser(id: string): Promise<any> {
- return FetchRequest.get(`${this.url}/${id}`, true);
- }
-
-
- static currentUser(): Promise<any> {
- return FetchRequest.get(`${this.url}/my`, true);
- }
- static update(id: string, user: User): Promise<any> {
- user.id = id;
- return FetchRequest.put(`${this.url}/update` , JSON.stringify(user), true);
- }
-
- //system/user/setUser
- //"registrationId":"11234'"userId": 49,
- static setUser(data:string): Promise<any> {
- return FetchRequest.post('/system/user/setUser' ,data, false);
- }
- /**
- * search好友
- * @param mobile mobile
- */
- static search(mobile: string): Promise<any> {
- return FetchRequest.get(`${this.url}/search?mobile=${mobile}`, true);
- }
- /**
- * 刷新用户密钥
- * @param oldPassword
- * @param newPassword
- */
- static updateUserPwd(oldPassword: string, newPassword: string): Promise<any> {
- const data = {
- oldPassword: oldPassword,
- newPassword: newPassword,
- };
- return FetchRequest.put(
- `${this.url}/updatePwd`,
- JSON.stringify(data),
- true
- );
- }
- }
- export default UserApi;
|