How to use the react-orbitjs.remoteIdentityFrom function in react-orbitjs

To help you get started, we’ve selected a few react-orbitjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / ui / components / product-transitions / details.tsx View on Github external
export default function TransitionDetails({ product }) {
  const { t } = useTranslations();
  const { dataStore } = useOrbit();
  const [transitions, setTransitions] = useState([]);
  const { currentUser } = useCurrentUser();
  const { timezone } = attributesFor(currentUser);

  const productRemoteId = remoteIdentityFrom(dataStore, product).keys.remoteId;

  useEffect(() => {
    async function fetcher() {
      let response = await get(`/api/products/${productRemoteId}/transitions`);
      try {
        let json = await response.json();

        let transitions = json.data;
        setTransitions(transitions || []);
      } catch (e) {
        console.debug('transitions not ready, or do not exist');
      }
    }

    fetcher();
  }, [productRemoteId, transitions.length === 0]);
github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / ui / components / product-artifact / actions.tsx View on Github external
export default function ItemActions({ product }) {
  const { t } = useTranslations();
  const { dataStore } = useOrbit();

  const [actions, setActions] = useState([]);

  const productRemoteId = remoteIdentityFrom(dataStore, product).keys.remoteId;

  useEffect(() => {
    async function fetcher() {
      let response = await get(`/api/products/${productRemoteId}/actions`);

      try {
        let json = await response.json();

        let { actions } = attributesFor(json.data);

        setActions(actions || []);
      } catch (e) {
        console.debug('actions not ready, or do not exist');
      }
    }