spoko-design-system 0.2.56 → 0.2.58
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.
- package/index.ts +1 -1
- package/package.json +1 -1
- package/src/utils/getData.ts +2 -7
package/index.ts
CHANGED
|
@@ -53,7 +53,7 @@ export { default as getProductChecklist } from './src/utils/product/getProductCh
|
|
|
53
53
|
export { default as getShorterDescription } from './src/utils/seo/getShorterDescription';
|
|
54
54
|
|
|
55
55
|
// Utils: Text
|
|
56
|
-
export {
|
|
56
|
+
export { default as getData} from './src/utils/getData';
|
|
57
57
|
// export { default as getData } from './src/utils/getData';
|
|
58
58
|
// export { getData } from './src/utils/getData';
|
|
59
59
|
export { getTranslation, text2paragraphs, countWords, firstSentence, removeSemicolon } from './src/utils/text';
|
package/package.json
CHANGED
package/src/utils/getData.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import fetch from 'node-fetch';
|
|
3
|
-
import dotenv from 'dotenv';
|
|
4
|
-
import path from 'node:path'; // dodajemy do bezpiecznej obsługi ścieżek
|
|
5
1
|
|
|
6
|
-
dotenv.config();
|
|
7
2
|
|
|
8
3
|
const API_URL = process.env.API_URL || '';
|
|
9
4
|
const CACHE_DIR = process.env.CACHE_DIR || './.cache';
|
|
@@ -15,8 +10,8 @@ interface ApiResponse<T> {
|
|
|
15
10
|
data: T;
|
|
16
11
|
}
|
|
17
12
|
|
|
18
|
-
export const getData = async <T>(type: string): Promise<T | null> => {
|
|
19
|
-
if (!
|
|
13
|
+
export const getData = async <T>(type: string, api: string): Promise<T | null> => {
|
|
14
|
+
if (!api) {
|
|
20
15
|
console.error("API_URL is not defined in .env");
|
|
21
16
|
return null;
|
|
22
17
|
}
|