Skip to content

Commit

Permalink
Merge pull request #510 from ertush/hotfix
Browse files Browse the repository at this point in the history
Added access_token as a parameter in the request of gis ward data
  • Loading branch information
ertush authored Oct 17, 2024
2 parents 1c8a63c + 5940f60 commit ddae0dc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
32 changes: 15 additions & 17 deletions components/Forms/BasicDetailsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,29 +168,27 @@ export function BasicDeatilsForm({ editMode }) {
})
})

const handleDateChange = useCallback((e) => {
// const handleDateChange = useCallback((e) => {

e.preventDefault()
// e.preventDefault()

if (e.currentTarget.name == "date_established") {
setDateValidationError(prev => ({ ...prev, date_established: null }))
}
const today = new Date()
// if (e.currentTarget.name == "date_established") {
// setDateValidationError(prev => ({ ...prev, date_established: null }))
// }
// const today = new Date()

const setDate = e.currentTarget.valueAsDate
// const setDate = e.currentTarget.valueAsDate

if (setDate > today) {
if (e.currentTarget.name == "date_established") {
setDateValidationError(prev => ({ ...prev, date_established: 'Date Established cannot be in the future' }))
}
// if (setDate > today) {
// if (e.currentTarget.name == "date_established") {
// setDateValidationError(prev => ({ ...prev, date_established: 'Date Established cannot be in the future' }))
// }

e.currentTarget.value = ''
// e.currentTarget.value = ''

}
})
// }
// })




const handleSelectChange = useCallback(async (e) => {

Expand Down Expand Up @@ -565,7 +563,7 @@ export function BasicDeatilsForm({ editMode }) {

if (facilityData) {
fetch(
`${process.env.NEXT_PUBLIC_API_URL}/common/wards/${facilityData?.ward}/`,
`${process.env.NEXT_PUBLIC_API_URL}/common/wards/${facilityData?.ward}`,
{
headers: {
Authorization: 'Bearer ' + options?.token,
Expand Down
6 changes: 3 additions & 3 deletions components/Forms/GeolocationForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ export function GeolocationForm({ editMode }) {
if (payload) {

const url = options?.data?.lat_long && options?.data?.coordinates ?
`${process.env.NEXT_PUBLIC_API_URL}/gis/facility_coordinates/${options?.data?.lat_long && `${options?.data?.coordinates}/`}` :
`${process.env.NEXT_PUBLIC_API_URL}/gis/facility_coordinates/`
`${process.env.NEXT_PUBLIC_API_URL}/gis/facility_coordinates/${options?.data?.lat_long && `${options?.data?.coordinates}/?access_token=${options?.token}`}` :
`${process.env.NEXT_PUBLIC_API_URL}/gis/facility_coordinates/?access_token=${options?.token}`


fetch(url, {
Expand Down Expand Up @@ -209,7 +209,7 @@ export function GeolocationForm({ editMode }) {
// console.log({payload})


fetch(`${process.env.NEXT_PUBLIC_API_URL}/gis/facility_coordinates/`, {
fetch(`${process.env.NEXT_PUBLIC_API_URL}/gis/facility_coordinates/?access_token=${options?.token}`, {
method: 'POST',
headers: {
'Accept': 'application/json',
Expand Down

0 comments on commit ddae0dc

Please sign in to comment.