fix bug getListUser
This commit is contained in:
parent
c30f4eb572
commit
43a1dfe8d2
2 changed files with 10 additions and 7 deletions
|
|
@ -209,7 +209,7 @@ export class KeycloakController extends Controller {
|
||||||
|
|
||||||
@Get("user")
|
@Get("user")
|
||||||
async getUserList(@Query() first = "", @Query() max = "", @Query() search = "") {
|
async getUserList(@Query() first = "", @Query() max = "", @Query() search = "") {
|
||||||
const total = await getUserCount();
|
const total = await getUserCount(first, max, search);
|
||||||
const result = await getUserList(first, max, search);
|
const result = await getUserList(first, max, search);
|
||||||
|
|
||||||
if (Array.isArray(result)) {
|
if (Array.isArray(result)) {
|
||||||
|
|
|
||||||
|
|
@ -150,13 +150,16 @@ export async function getUserList(first = "", max = "", search = "") {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getUserCount() {
|
export async function getUserCount(first = "", max = "", search = "") {
|
||||||
const res = await fetch(`${KC_URL}/admin/realms/${KC_REALM}/users/count`, {
|
const res = await fetch(
|
||||||
headers: {
|
`${KC_URL}/admin/realms/${KC_REALM}/users/count?first=${first || "0"}&max=${max || "-1"}${search ? `&search=${search}` : ""}`,
|
||||||
authorization: `Bearer ${await getToken()}`,
|
{
|
||||||
"content-type": `application/json`,
|
headers: {
|
||||||
|
authorization: `Bearer ${await getToken()}`,
|
||||||
|
"content-type": `application/json`,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}).catch((e) => console.log("Keycloak Error: ", e));
|
).catch((e) => console.log("Keycloak Error: ", e));
|
||||||
|
|
||||||
if (!res) return false;
|
if (!res) return false;
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue