feat: fix users list

This commit is contained in:
MingLiang Wang 2023-01-11 21:10:31 +08:00
parent fc2a5879bd
commit 932f5f02c4
2 changed files with 8 additions and 8 deletions

View File

@ -403,13 +403,13 @@ export class AffineProvider extends BaseProvider {
workspace_id: string,
email: string
): Promise<User | null> {
const user = await this._apis.getUserByEmail({ workspace_id, email });
return user
const users = await this._apis.getUserByEmail({ workspace_id, email });
return users?.length
? {
id: user.id,
name: user.name,
avatar: user.avatar_url,
email: user.email,
id: users[0].id,
name: users[0].name,
avatar: users[0].avatar_url,
email: users[0].email,
}
: null;
}

View File

@ -15,7 +15,7 @@ export interface User {
export async function getUserByEmail(
params: GetUserByEmailParams
): Promise<User | null> {
): Promise<User[] | null> {
const searchParams = new URLSearchParams({ ...params });
return client.get('api/user', { searchParams }).json<User | null>();
return client.get('api/user', { searchParams }).json<User[] | null>();
}