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

Fix errors from type casting in UI #141

Merged
merged 2 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ui/src/components/ApproversSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export default function ApproversSelect(props: ApproversSelectProps): JSX.Elemen
}, 800)

const _onSelectCandidate = (id: string) => {
const candidate = props.candidates.find(c => c.id.toString() ===id)
const candidate = props.candidates.find(c => c.id === parseInt(id))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual type of id is the number in the console.

if (candidate === undefined) {
return
throw new Error("The candidate is undefined.")
}

onSelectCandidate(candidate)
Expand Down
2 changes: 1 addition & 1 deletion ui/src/redux/repoDeploy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export const addTagManually = createAsyncThunk<Tag, string, { state: {repoDeploy
const { namespace, name } = getState().repoDeploy

try {
const tag = await getTag(namespace, name, name)
const tag = await getTag(namespace, name, tagName)
return tag
} catch(e) {
if (e instanceof HttpNotFoundError) {
Expand Down
4 changes: 2 additions & 2 deletions ui/src/views/Deployment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ export default function DeploymentView(): JSX.Element {
}

const onSelectCandidate = (id: string) => {
const approval = approvals.find(a => a.user?.id.toString() === id)
const approval = approvals.find(a => a.user?.id === parseInt(id))

if (approval !== undefined) {
dispatch(deleteApproval(approval))
return
}

const candidate = candidates.find(c => c.id.toString() === id)
const candidate = candidates.find(c => c.id === parseInt(id))
if (candidate === undefined) {
throw new Error("The candidate is not found")
}
Expand Down