Use environment checks

This commit is contained in:
Jed Fox
2023-01-01 10:28:14 -05:00
parent cf446743b3
commit 650733d51b

View File

@@ -1,12 +1,16 @@
import React, { useState } from 'react';
import { Modal } from 'loot-design/src/components/common';
import {
isDevelopmentEnvironment,
isPreviewEnvironment
} from 'loot-design/src/util/environment';
import ManageRules from '../ManageRules';
export default function ManageRulesModal({ modalProps, payeeId }) {
let [loading, setLoading] = useState(true);
if (process.env.NODE_ENV === 'development') {
if (isDevelopmentEnvironment() || isPreviewEnvironment()) {
if (location.pathname !== '/payees') {
throw new Error(
`Possibly invalid use of ManageRulesModal, add the current url '${location.pathname}' to the allowlist if you're confident the modal can never appear on top of the '/rules' page.`