Skip to content

Commit

Permalink
fix: coderabbit suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
thorkellmani committed Nov 12, 2024
1 parent 2cb7f41 commit 1c0d8af
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ export class BulkMileageService {
return {
code: e.errorCode ?? undefined,
message: e.errorText ?? undefined,
warningSerialCode: e.warningSerial ?? 0,
warningSerialCode: e.warningSerial,
warningText: warningSerial
? formatMessage(errorCodeMessageMap[warningSerial ?? 0])
? formatMessage(errorCodeMessageMap[warningSerial])
: undefined,
}
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ export class VehiclesService {
putMileageReadingModel: input,
})

return dtos[0]
return dtos.length > 0 ? dtos[0] : null
}

async postMileageReadingV2(
Expand Down Expand Up @@ -537,7 +537,7 @@ export class VehiclesService {
const dtos = await this.getMileageWithAuth(auth).rootPut({
putMileageReadingModel: input,
})
return dtos[0]
return dtos.length > 0 ? dtos[0] : null
} catch (e) {
if (e instanceof FetchError && (e.status === 400 || e.status === 429)) {
const errorBody = e.body as UpdateResponseError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useLocale, useNamespaces } from '@island.is/localization'
import {
m,
SAMGONGUSTOFA_SLUG,
IntroHeader,
LinkButton,
IntroWrapper,
} from '@island.is/service-portal/core'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ const VehicleBulkMileageUpload = () => {
setUploadErrorMessage(formatMessage(vehicleMessage.noDataInUploadedFile))
return
}
if (typeof records === 'string') {
setUploadErrorMessage(records)
return
}
vehicleBulkMileagePostMutation({
variables: {
input: {
Expand Down

0 comments on commit 1c0d8af

Please sign in to comment.