chore: move to use effect

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-06-08 15:52:45 +02:00
parent a22af3edc8
commit 94ce0cda13
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import React, { useEffect } from 'react';
import {
Page,
Header,
@@ -72,8 +72,13 @@ export const TemplateWizardPage = (props: TemplateWizardPageProps) => {
}),
);
useEffect(() => {
if (error) {
errorApi.post(new Error(`Failed to load template, ${error}`));
}
}, [error, errorApi]);
if (error) {
errorApi.post(new Error(`Failed to load template, ${error}`));
return <Navigate to={rootRef()} />;
}