فهرست منبع

import swr from node_modules & add with-utils at growi/core/src/utils

yohei0125 3 سال پیش
والد
کامیت
cceaa86ac3
2فایلهای تغییر یافته به همراه8 افزوده شده و 0 حذف شده
  1. 1 0
      packages/core/src/index.js
  2. 7 0
      packages/core/src/utils/with-utils.ts

+ 1 - 0
packages/core/src/index.js

@@ -20,3 +20,4 @@ export * from './service/localstorage-manager';
 export * from './utils/basic-interceptor';
 export * from './utils/browser-utils';
 export * from './utils/mongoose-utils';
+export * from '../../../node_modules/swr';

+ 7 - 0
packages/core/src/utils/with-utils.ts

@@ -0,0 +1,7 @@
+import { SWRResponse } from '../index';
+
+export type SWRResponseWithUtils<R extends SWRResponse, Utils> = R & Utils;
+
+export const withUtils = <R extends SWRResponse, U>(response: R, utils: U): SWRResponseWithUtils<R, U> => {
+  return Object.assign(response, utils);
+};