gotosocial/web/source/settings/lib/form/form-with-data.jsx

21 lines
493 B
React
Raw Normal View History

2023-01-08 17:14:46 +01:00
"use strict";
const React = require("react");
const Loading = require("../../components/loading");
// Wrap Form component inside component that fires the RTK Query call,
// so Form will only be rendered when data is available to generate form-fields for
module.exports = function FormWithData({ dataQuery, DataForm, arg }) {
const { data, isLoading } = dataQuery(arg);
2023-01-08 17:14:46 +01:00
if (isLoading) {
return (
<div>
<Loading />
</div>
);
2023-01-08 17:14:46 +01:00
} else {
return <DataForm data={data} />;
2023-01-08 17:14:46 +01:00
}
};