Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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]);
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');
}
}