Skip to content

Commit

Permalink
Extend checkForConflicts to verify any conflict inside the pages-grap…
Browse files Browse the repository at this point in the history
…hql bucket
  • Loading branch information
vitorflg committed Oct 10, 2024
1 parent 7a2e717 commit c7fc866
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/api/clients/IOClients/infra/VBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class VBase extends InfraClient {
})
}

// Resolve a specific pages-graphql conflict
public resolveConflict = (bucketKey: string, path: string, content: any) => {
const data = [
{
Expand All @@ -36,22 +37,17 @@ export class VBase extends InfraClient {
})
}

// List all conflicts in the pages-graphql bucket
public getConflicts = async () => {
return this.http.get(routes.Conflicts('vtex.pages-graphql/userData'), {
metric: 'vbase-get-conflicts',
})
}

// Verify if there is at least one conlfict in the pages-graphql bucket
public checkForConflicts = async () => {
let status: number
try {
const response = await this.http.get(routes.File('vtex.pages-graphql/userData', 'store/content.json'), {
metric: 'vbase-conflict',
})
status = response.status
} catch (error) {
status = error.response && error.response.status
}
return status === 409
const response = await this.getConflicts().then(res => res.data)

return response?.data?.length > 0
}
}

0 comments on commit c7fc866

Please sign in to comment.