mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 04:54:18 +00:00
20 lines
536 B
JavaScript
20 lines
536 B
JavaScript
import React from "react"
|
|
import Loading from "../components/base/Loading"
|
|
import BoxAlert from "../components/base/BoxAlert"
|
|
import Starting from "../components/base/Starting"
|
|
|
|
|
|
export default function renderContents(requestHookResults, renderFunction) {
|
|
const { data, error, loading } = requestHookResults
|
|
|
|
if(loading) {
|
|
return <Loading/>
|
|
}
|
|
if(error) {
|
|
return <BoxAlert color={"Red"}>{error.toString()}</BoxAlert>
|
|
}
|
|
if(data) {
|
|
return renderFunction(data)
|
|
}
|
|
return <Starting/>
|
|
}
|