Skip to content

Instantly share code, notes, and snippets.

@berat
Last active May 24, 2020 14:23
Show Gist options
  • Save berat/e47bb0f58f027f02f36c4a500718c417 to your computer and use it in GitHub Desktop.
Save berat/e47bb0f58f027f02f36c4a500718c417 to your computer and use it in GitHub Desktop.
const getData = async () => {
const response = await Axios.get(
`${config.apiURL}${config.version}users/${userid}`
)
if (response.data.status == 201) {
setLoad({ load: true, check: true })
setCheckUserID(response.data.userid)
} else {
setLoad({ load: true, check: false })
}
}
useEffect(() => {
getData()
}, [])
return load.load ? (
load.check ? (
<Layout userid={checkUserID}></Layout>
) : (
<Error />
)
) : (
<Preloader
style={{ position: 'absolute', top: '45%', left: '50%' }}
use={Puff}
size={100}
strokeWidth={6}
strokeColor="#29D"
duration={2000}
/>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment