Skip to content

Commit

Permalink
Merge pull request #551 from ertush/hotfix
Browse files Browse the repository at this point in the history
added try catch statement in code to handle facility search
  • Loading branch information
ertush authored Nov 20, 2024
2 parents 015b1ec + 917162d commit 4d87aed
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pages/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ function Dashboard(props) {
onChange={value => handlePresentationChange(value, 'facility_chu_chart')}
placeholder="presentation type"
title="Select Presentation Type"
className='self-end z-40' />
className='self-end' />

</div>
}
Expand Down Expand Up @@ -1321,7 +1321,7 @@ function Dashboard(props) {
onChange={value => handlePresentationChange(value, 'facility_chu_chart')}
placeholder="presentation type"
title="Select Presentation Type"
className='self-end z-40' />
className='self-end' />

</div>

Expand Down
26 changes: 19 additions & 7 deletions pages/facilities/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ function FacilityHome(props) {
const dataFetcher = async (url) => {
let token = null

let response = []


if(!!window){
const cookie = document.cookie
const access_token = JSON.parse(cookie.split('=')[1])?.token
Expand All @@ -152,13 +155,22 @@ function FacilityHome(props) {
}


return token ? await (await fetch(url, {
headers: {
Accept: 'application/json, */*',
Authorization: `Bearer ${token}`

}
})).json() : Promise((_, reject) => reject('Token is not valid'))
try {
response = await (await fetch(url, {
headers: {
Accept: 'application/json, */*',
Authorization: `Bearer ${token}`
}
})).json()
}
catch(e) {
console.log(e.message)
}

return response



}

/**
Expand Down
6 changes: 3 additions & 3 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ function Home() {

<div className="w-full h-screen overflow-y-scroll flex flex-col items-center md:items-start">

<div className='w-full h-auto z-10 fixed top-0 overflow-hidden'>
<div className='w-full h-auto fixed top-0 z-10 flex flex-col gap-0 justify-start'>
{/* Logo And Title */}
<div className='w-full fixed max-h-min bg-gray-50 flex'>
<div className='w-full max-h-min bg-gray-50 flex'>
{/* Heading */}
<div className="max-h-min w-[80%] container flex mx-auto">
{/* Heading */}
Expand Down Expand Up @@ -126,7 +126,7 @@ function Home() {
</div>

{/* Menu Heading */}
<div className='w-full md:mt-[104px] mt-[25%] overflow-hidden bg-gray-300 max-h-min flex items-center justify-between md:items-start md:items-between p-3 md:p-0'>
<div className='w-full overflow-hidden bg-gray-300 max-h-min flex items-center justify-between md:items-start md:items-between p-3 md:p-0'>

{/* Menu Heading */}
<nav className="hidden max-h-min w-[60%] container md:flex mx-auto ">
Expand Down

0 comments on commit 4d87aed

Please sign in to comment.