mirror of https://github.com/halo-dev/halo
perf: hide anonymousUser in user filter dropdown list (halo-dev/console#891)
#### What type of PR is this? /kind improvement #### What this PR does / why we need it: 在用户条件筛选框中隐藏匿名用户。 #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/3407 #### Screenshots: <img width="864" alt="image" src="https://user-images.githubusercontent.com/21301288/221490795-eaf9c515-e487-4d76-87dd-f0010415360e.png"> #### Special notes for your reviewer: None #### Does this PR introduce a user-facing change? ```release-note None ```pull/3445/head
parent
ca0c0b8140
commit
7b04b81f35
|
@ -17,10 +17,14 @@ export function useUserFetch(options?: {
|
||||||
const users = ref<User[]>([] as User[]);
|
const users = ref<User[]>([] as User[]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
|
||||||
|
const ANONYMOUSUSER_NAME = "anonymousUser";
|
||||||
|
|
||||||
const handleFetchUsers = async () => {
|
const handleFetchUsers = async () => {
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const { data } = await apiClient.extension.user.listv1alpha1User();
|
const { data } = await apiClient.extension.user.listv1alpha1User({
|
||||||
|
fieldSelector: [`name!=${ANONYMOUSUSER_NAME}`],
|
||||||
|
});
|
||||||
users.value = data.items;
|
users.value = data.items;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Failed to fetch users", e);
|
console.error("Failed to fetch users", e);
|
||||||
|
|
Loading…
Reference in New Issue