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"
|
2021-05-24 12:49:59 +00:00
|
|
|
import Alert from "../components/base/Alert"
|
2021-05-11 15:05:38 +00:00
|
|
|
import Starting from "../components/base/Starting"
|
|
|
|
|
|
|
|
|
2021-05-25 02:09:47 +00:00
|
|
|
/**
|
|
|
|
* @deprecated
|
|
|
|
*/
|
2021-05-11 15:05:38 +00:00
|
|
|
export default function renderContents(requestHookResults, renderFunction) {
|
|
|
|
const { data, error, loading } = requestHookResults
|
|
|
|
|
|
|
|
if(loading) {
|
|
|
|
return <Loading/>
|
|
|
|
}
|
|
|
|
if(error) {
|
2021-05-24 12:49:59 +00:00
|
|
|
return <Alert color={"Red"}>{error.toString()}</Alert>
|
2021-05-11 15:05:38 +00:00
|
|
|
}
|
|
|
|
if(data) {
|
|
|
|
return renderFunction(data)
|
|
|
|
}
|
|
|
|
return <Starting/>
|
|
|
|
}
|