Skip to content

Commit

Permalink
Merge pull request #1038 from pokt-foundation/use-phd-v1
Browse files Browse the repository at this point in the history
feat: update phd-client to use v1 endpoints
  • Loading branch information
commoddity authored Feb 7, 2023
2 parents c16a21e + 2ab3f15 commit 90fcc71
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/services/phd-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class PHDClient {
throw new Error(`cacheKey not set for path ${path}`)
}

const url = `${this.baseUrl}/${path}`
const url = `${this.baseUrl}/v1/${path}`
const modelFields = this.getRequiredModelFields(model)
const modelsData: T[] = []

Expand All @@ -96,7 +96,7 @@ class PHDClient {
}

async findById<T extends Entity>({ path, id, model, cache }: FindOneParams): Promise<T> {
const url = `${this.baseUrl}/${path}/${id}`
const url = `${this.baseUrl}/v1/${path}/${id}`
const modelFields = this.getRequiredModelFields(model)
let modelData: T

Expand Down Expand Up @@ -128,7 +128,7 @@ class PHDClient {
}

async count({ path }: CountParams): Promise<Count> {
const url = `${this.baseUrl}/${path}`
const url = `${this.baseUrl}/v1/${path}`

try {
const { data: documents } = await axios.get(url, { headers: { authorization: this.apiKey } })
Expand Down Expand Up @@ -157,8 +157,8 @@ class PHDClient {

// Necessary to recreate the `applicationIDs` array from the data provided by PHD
processLoadBalancer(document): LoadBalancers {
document.applicationIDs = document.Applications.map(({ id: appID }) => appID)
delete document.Applications
document.applicationIDs = document.applications.map(({ id: appID }) => appID)
delete document.applications

if (document.userID && !document.user) {
document.user = document.userID
Expand Down

0 comments on commit 90fcc71

Please sign in to comment.