From da941dfb049d5d684c96ad9c2d8da0a63b199324 Mon Sep 17 00:00:00 2001 From: stbui Date: Wed, 30 Oct 2019 23:00:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(core):=20=E5=A2=9E=E5=8A=A0=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/controller/useShowController.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/core/src/controller/useShowController.ts b/packages/core/src/controller/useShowController.ts index bf298e9..e1f2190 100644 --- a/packages/core/src/controller/useShowController.ts +++ b/packages/core/src/controller/useShowController.ts @@ -1,10 +1,11 @@ /** * @license * Copyright Stbui All Rights Reserved. - * https://github.com/stbui + * https://github.com/stbui/prophet */ import { useGetOne } from '../dataProvider'; +import { useNotify } from '../sideEffect'; export interface ShowProps { resource: string; @@ -14,8 +15,13 @@ export interface ShowProps { export const useShowController = (props: ShowProps) => { const { resource, basePath, id } = props; + const notify = useNotify(); - const { data: record, loading } = useGetOne(resource, id); + const { data: record, loading } = useGetOne(resource, id, { + onFailure: () => { + notify('获取失败', 'error'); + }, + }); return { resource,