Skip to content

Commit c7fc866

Browse files
committed
Extend checkForConflicts to verify any conflict inside the pages-graphql bucket
1 parent 7a2e717 commit c7fc866

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/api/clients/IOClients/infra/VBase.ts

+6-10
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export class VBase extends InfraClient {
2222
})
2323
}
2424

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

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

47+
// Verify if there is at least one conlfict in the pages-graphql bucket
4548
public checkForConflicts = async () => {
46-
let status: number
47-
try {
48-
const response = await this.http.get(routes.File('vtex.pages-graphql/userData', 'store/content.json'), {
49-
metric: 'vbase-conflict',
50-
})
51-
status = response.status
52-
} catch (error) {
53-
status = error.response && error.response.status
54-
}
55-
return status === 409
49+
const response = await this.getConflicts().then(res => res.data)
50+
51+
return response?.data?.length > 0
5652
}
5753
}

0 commit comments

Comments
 (0)