make reported user nullable
All checks were successful
delpoy / build-and-deploy (push) Successful in 44s
All checks were successful
delpoy / build-and-deploy (push) Successful in 44s
This commit is contained in:
18
src/lib/utils.ts
Normal file
18
src/lib/utils.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { env } from '$env/dynamic/public';
|
||||
|
||||
export async function usernameSuggestions(
|
||||
username: string
|
||||
): Promise<{ name: string; value: string }[]> {
|
||||
const response = await fetch(`${env.PUBLIC_BASE_PATH}/admin/users`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
limit: 6,
|
||||
search: username,
|
||||
slim: true
|
||||
})
|
||||
});
|
||||
const json: { username: string; uuid: string }[] = await response.json();
|
||||
return json.map((v) => {
|
||||
return { name: v.username, value: v.uuid };
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user