2022-10-22 19:51:07 +00:00
|
|
|
import { BaseCRUDAPI } from "../base/base-clients";
|
|
|
|
import { UnlockResults, UserIn, UserOut } from "~/lib/api/types/user";
|
2021-11-24 03:57:24 +00:00
|
|
|
|
|
|
|
const prefix = "/api";
|
|
|
|
|
|
|
|
const routes = {
|
|
|
|
adminUsers: `${prefix}/admin/users`,
|
|
|
|
adminUsersId: (tag: string) => `${prefix}/admin/users/${tag}`,
|
2022-08-13 21:18:12 +00:00
|
|
|
adminResetLockedUsers: (force: boolean) => `${prefix}/admin/users/unlock?force=${force ? "true" : "false"}`,
|
2021-11-24 03:57:24 +00:00
|
|
|
};
|
|
|
|
|
2022-05-21 19:22:02 +00:00
|
|
|
export class AdminUsersApi extends BaseCRUDAPI<UserIn, UserOut, UserOut> {
|
2021-11-24 03:57:24 +00:00
|
|
|
baseRoute: string = routes.adminUsers;
|
|
|
|
itemRoute = routes.adminUsersId;
|
2022-08-13 21:18:12 +00:00
|
|
|
|
|
|
|
async unlockAllUsers(force = false) {
|
|
|
|
return await this.requests.post<UnlockResults>(routes.adminResetLockedUsers(force), {});
|
|
|
|
}
|
2021-11-24 03:57:24 +00:00
|
|
|
}
|