Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 4b7beb5

Browse files
author
noah
committed
Fix errors from type in UI
1 parent 9c01912 commit 4b7beb5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ui/src/components/ApproversSelect.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export default function ApproversSelect(props: ApproversSelectProps): JSX.Elemen
3232
}, 800)
3333

3434
const _onSelectCandidate = (id: string) => {
35-
const candidate = props.candidates.find(c => c.id.toString() ===id)
35+
const candidate = props.candidates.find(c => c.id === parseInt(id))
3636
if (candidate === undefined) {
37-
return
37+
throw new Error("The candidate is undefined.")
3838
}
3939

4040
onSelectCandidate(candidate)

ui/src/views/Deployment.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ export default function DeploymentView(): JSX.Element {
101101
}
102102

103103
const onSelectCandidate = (id: string) => {
104-
const approval = approvals.find(a => a.user?.id.toString() === id)
104+
const approval = approvals.find(a => a.user?.id === parseInt(id))
105105

106106
if (approval !== undefined) {
107107
dispatch(deleteApproval(approval))
108108
return
109109
}
110110

111-
const candidate = candidates.find(c => c.id.toString() === id)
111+
const candidate = candidates.find(c => c.id === parseInt(id))
112112
if (candidate === undefined) {
113113
throw new Error("The candidate is not found")
114114
}

0 commit comments

Comments
 (0)