mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 06:16:59 +08:00
feat: fix users list
This commit is contained in:
@@ -403,13 +403,13 @@ export class AffineProvider extends BaseProvider {
|
|||||||
workspace_id: string,
|
workspace_id: string,
|
||||||
email: string
|
email: string
|
||||||
): Promise<User | null> {
|
): Promise<User | null> {
|
||||||
const user = await this._apis.getUserByEmail({ workspace_id, email });
|
const users = await this._apis.getUserByEmail({ workspace_id, email });
|
||||||
return user
|
return users?.length
|
||||||
? {
|
? {
|
||||||
id: user.id,
|
id: users[0].id,
|
||||||
name: user.name,
|
name: users[0].name,
|
||||||
avatar: user.avatar_url,
|
avatar: users[0].avatar_url,
|
||||||
email: user.email,
|
email: users[0].email,
|
||||||
}
|
}
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export interface User {
|
|||||||
|
|
||||||
export async function getUserByEmail(
|
export async function getUserByEmail(
|
||||||
params: GetUserByEmailParams
|
params: GetUserByEmailParams
|
||||||
): Promise<User | null> {
|
): Promise<User[] | null> {
|
||||||
const searchParams = new URLSearchParams({ ...params });
|
const searchParams = new URLSearchParams({ ...params });
|
||||||
return client.get('api/user', { searchParams }).json<User | null>();
|
return client.get('api/user', { searchParams }).json<User[] | null>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user