|
@@ -14,10 +14,16 @@ import { IPageTagsInfo } from '../interfaces/tag';
|
|
|
|
|
|
|
|
import { useCurrentPageId } from './context';
|
|
import { useCurrentPageId } from './context';
|
|
|
|
|
|
|
|
-export const useSWRxPage = (pageId?: string|null, shareLinkId?: string): SWRResponse<IPagePopulatedToShowRevision, Error> => {
|
|
|
|
|
- return useSWR<IPagePopulatedToShowRevision, Error>(
|
|
|
|
|
|
|
+export const useSWRxPage = (pageId?: string|null, shareLinkId?: string): SWRResponse<IPagePopulatedToShowRevision, any> => {
|
|
|
|
|
+ return useSWR<IPagePopulatedToShowRevision, any>(
|
|
|
pageId != null ? ['/page', pageId, shareLinkId] : null,
|
|
pageId != null ? ['/page', pageId, shareLinkId] : null,
|
|
|
(endpoint, pageId, shareLinkId) => apiv3Get<{ page: IPagePopulatedToShowRevision }>(endpoint, { pageId, shareLinkId }).then(result => result.data.page),
|
|
(endpoint, pageId, shareLinkId) => apiv3Get<{ page: IPagePopulatedToShowRevision }>(endpoint, { pageId, shareLinkId }).then(result => result.data.page),
|
|
|
|
|
+ {
|
|
|
|
|
+ onErrorRetry: (error) => {
|
|
|
|
|
+ // for empty page
|
|
|
|
|
+ if (error[0].status === 404) return;
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
|
|
|