diff --git a/package.json b/package.json index 2cfd465..2a517f9 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "koa-router": "7.4.0", "koa-session": "5.12.3", "koa-static": "5.0.0", - "lodash": "4.17.19", + "lodash": "^4.17.19", "markdown-to-jsx": "^6.11.4", "mockjs": "1.1.0", "moment": "2.24.0", diff --git a/src/components/editor/InterfaceForm.tsx b/src/components/editor/InterfaceForm.tsx index 637e96b..a4ffbe8 100644 --- a/src/components/editor/InterfaceForm.tsx +++ b/src/components/editor/InterfaceForm.tsx @@ -9,6 +9,7 @@ import { makeStyles } from '@material-ui/styles' import { SlideUp } from 'components/common/Transition' import { Interface, Repository, RootState, Module } from '../../actions/types' import { updateInterface, addInterface } from '../../actions/interface' +import { StoreStateRouterLocationURI, push } from 'family' export const METHODS = ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH', 'HEAD'] export const STATUS_LIST = [200, 301, 403, 404, 500, 502, 503, 504] @@ -71,6 +72,7 @@ function InterfaceForm(props: Props) { const { open, onClose, itf, title, repository, mod } = props const classes = useStyles() const dispatch = useDispatch() + const router = useSelector((state: RootState) => state.router) return ( { - // dispatch(refresh()) + addOrUpdateInterface(itf, (e) => { + if (e && e.id) { + const href = StoreStateRouterLocationURI(router) + .setSearch('itf', e.id) + .href() + dispatch(push(href)) + } onClose(true) }) ) diff --git a/src/relatives/effects/interface.ts b/src/relatives/effects/interface.ts index cda783e..b61b4f5 100644 --- a/src/relatives/effects/interface.ts +++ b/src/relatives/effects/interface.ts @@ -33,7 +33,7 @@ export function* addInterface(action: any) { try { const payload = yield call(EditorService.addInterface, action.interface) yield put(InterfaceAction.addInterfaceSucceeded(payload)) - if (action.onResolved) { action.onResolved() } + if (action.onResolved) { action.onResolved(payload.itf) } } catch (e) { console.error(e.message) yield put(InterfaceAction.addInterfaceFailed(e.message))