Skip to content

Commit

Permalink
Exact match competition from search
Browse files Browse the repository at this point in the history
  • Loading branch information
simonkellly committed Jun 20, 2024
1 parent 6e166c8 commit dc3a00c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/logic/organizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ export async function searchForCompId(query: string): Promise<string | undefined
return undefined;
}

const json = await response.json() as { result: { id: string }[] };
return json?.result[0]?.id;
const json = await response.json() as { result: { id: string, name: string }[] };
const match = json.result.find(c => c.id == query || c.name == query);
return match ?? json?.result[0]?.id;

Check failure on line 143 in src/logic/organizer.ts

View workflow job for this annotation

GitHub Actions / build

Type 'string | { id: string; name: string; }' is not assignable to type 'string | undefined'.
}

export async function sortPasswords(
Expand Down

0 comments on commit dc3a00c

Please sign in to comment.