Skip to content

Commit

Permalink
Switch to latest API endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Destiner committed Jun 27, 2024
1 parent aa0e699 commit 5cc5911
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/services/labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ class Service {
chain: this.chainId.toString(),
address,
};
const url = new URL(`${labelApiEndpoint}/one`);
const url = new URL(`${labelApiEndpoint}/all`);
url.search = new URLSearchParams(params).toString();
const response = await fetch(url);
const label: LabelWithAddress | null = await response.json();
return label;
const labels: Label[] = await response.json();
if (labels.length === 0) {
return null;
}
return labels[0] as LabelWithAddress;
}

public async getLabels(
Expand All @@ -62,7 +65,7 @@ class Service {
chain: this.chainId.toString(),
};
const body = JSON.stringify({ addresses });
const url = new URL(`${labelApiEndpoint}/many`);
const url = new URL(`${labelApiEndpoint}/primary`);
url.search = new URLSearchParams(params).toString();
const response = await fetch(url, {
method: 'POST',
Expand Down

0 comments on commit 5cc5911

Please sign in to comment.