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

Commit

Permalink
Fix errors from type casting in UI (#141)
Browse files Browse the repository at this point in the history
* Fix typo: `addTagManually`
  • Loading branch information
Noah Hanjun Lee authored Oct 1, 2021
1 parent 247a4ed commit ac2b0c1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
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))
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)

This comment has been minimized.

Copy link
@noahingh

noahingh Oct 2, 2021

Member

Fix the mistake.

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

0 comments on commit ac2b0c1

Please sign in to comment.