Skip to content
Snippets Groups Projects
Unverified Commit 650733d5 authored by Jed Fox's avatar Jed Fox
Browse files

Use environment checks

parent cf446743
No related branches found
No related tags found
No related merge requests found
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Modal } from 'loot-design/src/components/common'; import { Modal } from 'loot-design/src/components/common';
import {
isDevelopmentEnvironment,
isPreviewEnvironment
} from 'loot-design/src/util/environment';
import ManageRules from '../ManageRules'; import ManageRules from '../ManageRules';
export default function ManageRulesModal({ modalProps, payeeId }) { export default function ManageRulesModal({ modalProps, payeeId }) {
let [loading, setLoading] = useState(true); let [loading, setLoading] = useState(true);
if (process.env.NODE_ENV === 'development') { if (isDevelopmentEnvironment() || isPreviewEnvironment()) {
if (location.pathname !== '/payees') { if (location.pathname !== '/payees') {
throw new Error( 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.` `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.`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment