|
|
@@ -10,5 +10,10 @@ const fetchShareLinks = async(endpoint, pageId) => {
|
|
|
};
|
|
|
|
|
|
export const useSWRxSharelink = (currentPageId: Nullable<string>): SWRResponse<IResShareLinkList['shareLinksResult'], Error> => {
|
|
|
- return useSWR(['/share-links/', currentPageId], (endpoint => fetchShareLinks(endpoint, currentPageId)));
|
|
|
+ return useSWR(['/share-links/', currentPageId], ((endpoint) => {
|
|
|
+ if (currentPageId == null) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ return fetchShareLinks(endpoint, currentPageId);
|
|
|
+ }));
|
|
|
};
|