UNPKG

respond-framework

Version:
22 lines (21 loc) 564 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _trySync = require("../../utils/trySync.js"); const redirect0 = (state, e) => { if (!e.event.redirect) return; const res = e.event.redirect.call(state, state, e); state.respond.devtools.sendPluginNotification({ type: 'redirect', returned: res }, e); return (0, _trySync.default)(res, r => redirect(e, r)); }; var _default = exports.default = redirect0; const redirect = (from, res) => res?.dispatch?.({ meta: { from } }) ?? res;