GitHub-Jobs-API-React-App icon indicating copy to clipboard operation
GitHub-Jobs-API-React-App copied to clipboard

Use checked state of checkbox instead of its value

Open achim-t opened this issue 4 years ago • 2 comments

The value of a checkbox is always empty therefore the query string wouldn't include the value for full_time. We have to use the checked state instead.

(The API only filters for full_time=true, otherwise no filtering is happening. So requesting positions with full_time=false will return full time jobs as well.)

achim-t avatar Aug 20 '20 15:08 achim-t

Correct :)

webcrafters avatar Sep 08 '20 16:09 webcrafters

const handleParamChange = e => {
    const param = e.target.name
    const value = param === "full_time" ? e.target.checked : e.target.value
    setPage(1)
    setParams(previousParams => {
      return {...previousParams, [param]: value}
    })
}

bdmessenger avatar Oct 15 '20 20:10 bdmessenger