mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
fix: digest score api timeout = 5 seconds
This commit is contained in:
parent
a7ba02e063
commit
0dada2d708
1 changed files with 4 additions and 9 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import axios from 'axios'
|
||||
import { env } from '../env'
|
||||
|
||||
export interface Feature {
|
||||
|
|
@ -62,20 +63,14 @@ class ScoreClientImpl implements ScoreClient {
|
|||
}
|
||||
|
||||
async getScores(data: ScoreApiRequestBody): Promise<ScoreApiResponse> {
|
||||
const response = await fetch(this.apiUrl, {
|
||||
method: 'POST',
|
||||
const response = await axios.post<ScoreApiResponse>(this.apiUrl, data, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
timeout: 5000,
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to score candidates: ${response.statusText}`)
|
||||
}
|
||||
|
||||
const scores = (await response.json()) as ScoreApiResponse
|
||||
return scores
|
||||
return response.data
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue