Throw if we cant sign the request

This commit is contained in:
Jackson Harper
2024-07-05 16:43:29 +08:00
parent 3fed16d936
commit 59852a1565

View File

@ -78,9 +78,12 @@ class ScoreClientImpl implements ScoreClient {
async getScores(data: ScoreApiRequestBody): Promise<ScoreApiResponse> {
const start = Date.now()
const authToken = await createWebAuthToken(data.user_id)
try {
const authToken = await createWebAuthToken(data.user_id)
if (!authToken) {
throw Error('could not create auth token')
}
const response = await axios.post<ScoreApiResponse>(this.apiUrl, data, {
headers: {
Authorization: `Bearer ${authToken}`,