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, 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;
} }

View File

@@ -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>();
} }