2021-05-12 23:07:17 +00:00
|
|
|
import React from "react"
|
2021-05-11 15:05:38 +00:00
|
|
|
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) {
|
2021-05-11 16:05:01 +00:00
|
|
|
return <BoxAlert color={"Red"}>{error.toString()}</BoxAlert>
|
2021-05-11 15:05:38 +00:00
|
|
|
}
|
|
|
|
if(data) {
|
|
|
|
return renderFunction(data)
|
|
|
|
}
|
|
|
|
return <Starting/>
|
|
|
|
}
|