@selfcommunity/react-core 0.6.7-payments.165 → 0.6.7-payments.168
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,10 +11,11 @@ import { SCCustomAdvPosition, SCCustomAdvType } from '@selfcommunity/types';
|
|
|
11
11
|
* @param object.categoriesId
|
|
12
12
|
* @param object.cacheStrategy
|
|
13
13
|
*/
|
|
14
|
-
export default function useSCFetchCustomAdv({ id, position, categoriesId, cacheStrategy, }: {
|
|
14
|
+
export default function useSCFetchCustomAdv({ id, position, categoriesId, active, cacheStrategy, }: {
|
|
15
15
|
id?: number;
|
|
16
16
|
position?: SCCustomAdvPosition;
|
|
17
17
|
categoriesId?: Array<number>;
|
|
18
|
+
active?: boolean;
|
|
18
19
|
cacheStrategy?: CacheStrategies;
|
|
19
20
|
}): {
|
|
20
21
|
scCustomAdv: SCCustomAdvType;
|
|
@@ -17,7 +17,7 @@ const Cache_1 = require("../constants/Cache");
|
|
|
17
17
|
* @param object.categoriesId
|
|
18
18
|
* @param object.cacheStrategy
|
|
19
19
|
*/
|
|
20
|
-
function useSCFetchCustomAdv({ id = null, position = null, categoriesId = null, cacheStrategy = utils_1.CacheStrategies.CACHE_FIRST, }) {
|
|
20
|
+
function useSCFetchCustomAdv({ id = null, position = null, categoriesId = null, active = true, cacheStrategy = utils_1.CacheStrategies.CACHE_FIRST, }) {
|
|
21
21
|
const [scCustomAdv, setSCCustomAdv] = (0, react_1.useState)(id !== null && cacheStrategy === utils_1.CacheStrategies.CACHE_FIRST && utils_1.LRUCache.get((0, Cache_1.getAdvObjectCacheKey)(id))
|
|
22
22
|
? utils_1.LRUCache.get((0, Cache_1.getAdvObjectCacheKey)(id))
|
|
23
23
|
: null);
|
|
@@ -39,7 +39,7 @@ function useSCFetchCustomAdv({ id = null, position = null, categoriesId = null,
|
|
|
39
39
|
if (id !== null) {
|
|
40
40
|
return api_services_1.http
|
|
41
41
|
.request({
|
|
42
|
-
url: api_services_1.Endpoints.CustomAdv.url({ id })
|
|
42
|
+
url: `${api_services_1.Endpoints.CustomAdv.url({ id })}?active=${Boolean(active)}`,
|
|
43
43
|
method: api_services_1.Endpoints.CustomAdv.method,
|
|
44
44
|
})
|
|
45
45
|
.then((res) => {
|
|
@@ -51,7 +51,7 @@ function useSCFetchCustomAdv({ id = null, position = null, categoriesId = null,
|
|
|
51
51
|
}
|
|
52
52
|
return api_services_1.http
|
|
53
53
|
.request({
|
|
54
|
-
url: api_services_1.Endpoints.CustomAdvSearch.url({})
|
|
54
|
+
url: `${api_services_1.Endpoints.CustomAdvSearch.url({})}?active=${Boolean(active)}`,
|
|
55
55
|
method: api_services_1.Endpoints.CustomAdvSearch.method,
|
|
56
56
|
params: Object.assign(Object.assign({}, (position && { position: position })), { categories: categoriesId ? `[${categoriesId.toString()}]` : '[]' }),
|
|
57
57
|
})
|
|
@@ -11,10 +11,11 @@ import { SCCustomAdvPosition, SCCustomAdvType } from '@selfcommunity/types';
|
|
|
11
11
|
* @param object.categoriesId
|
|
12
12
|
* @param object.cacheStrategy
|
|
13
13
|
*/
|
|
14
|
-
export default function useSCFetchCustomAdv({ id, position, categoriesId, cacheStrategy, }: {
|
|
14
|
+
export default function useSCFetchCustomAdv({ id, position, categoriesId, active, cacheStrategy, }: {
|
|
15
15
|
id?: number;
|
|
16
16
|
position?: SCCustomAdvPosition;
|
|
17
17
|
categoriesId?: Array<number>;
|
|
18
|
+
active?: boolean;
|
|
18
19
|
cacheStrategy?: CacheStrategies;
|
|
19
20
|
}): {
|
|
20
21
|
scCustomAdv: SCCustomAdvType;
|
|
@@ -14,7 +14,7 @@ import { getAdvObjectCacheKey } from '../constants/Cache';
|
|
|
14
14
|
* @param object.categoriesId
|
|
15
15
|
* @param object.cacheStrategy
|
|
16
16
|
*/
|
|
17
|
-
export default function useSCFetchCustomAdv({ id = null, position = null, categoriesId = null, cacheStrategy = CacheStrategies.CACHE_FIRST, }) {
|
|
17
|
+
export default function useSCFetchCustomAdv({ id = null, position = null, categoriesId = null, active = true, cacheStrategy = CacheStrategies.CACHE_FIRST, }) {
|
|
18
18
|
const [scCustomAdv, setSCCustomAdv] = useState(id !== null && cacheStrategy === CacheStrategies.CACHE_FIRST && LRUCache.get(getAdvObjectCacheKey(id))
|
|
19
19
|
? LRUCache.get(getAdvObjectCacheKey(id))
|
|
20
20
|
: null);
|
|
@@ -36,7 +36,7 @@ export default function useSCFetchCustomAdv({ id = null, position = null, catego
|
|
|
36
36
|
if (id !== null) {
|
|
37
37
|
return http
|
|
38
38
|
.request({
|
|
39
|
-
url: Endpoints.CustomAdv.url({ id })
|
|
39
|
+
url: `${Endpoints.CustomAdv.url({ id })}?active=${Boolean(active)}`,
|
|
40
40
|
method: Endpoints.CustomAdv.method,
|
|
41
41
|
})
|
|
42
42
|
.then((res) => {
|
|
@@ -48,7 +48,7 @@ export default function useSCFetchCustomAdv({ id = null, position = null, catego
|
|
|
48
48
|
}
|
|
49
49
|
return http
|
|
50
50
|
.request({
|
|
51
|
-
url: Endpoints.CustomAdvSearch.url({})
|
|
51
|
+
url: `${Endpoints.CustomAdvSearch.url({})}?active=${Boolean(active)}`,
|
|
52
52
|
method: Endpoints.CustomAdvSearch.method,
|
|
53
53
|
params: Object.assign(Object.assign({}, (position && { position: position })), { categories: categoriesId ? `[${categoriesId.toString()}]` : '[]' }),
|
|
54
54
|
})
|