@pretto/places 0.43.0 → 0.45.0

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/dist/index.js CHANGED
@@ -60,14 +60,24 @@ const fetchData = (url, signal) => __awaiter(void 0, void 0, void 0, function* (
60
60
  'Content-Type': 'application/json',
61
61
  },
62
62
  mode: 'cors',
63
- credentials: 'omit',
63
+ credentials: 'same-origin',
64
64
  cache: 'no-cache',
65
65
  redirect: 'follow',
66
66
  referrerPolicy: 'no-referrer',
67
67
  });
68
+ console.log('RESPONSE', response);
68
69
  if (!response.ok) {
69
70
  throw new Error(`Erreur HTTP: ${response.status} - ${response.statusText}`);
70
71
  }
72
+ // Vérification des en-têtes de réponse
73
+ const contentType = response.headers.get('content-type');
74
+ if (contentType && contentType.includes('application/json')) {
75
+ // Si c'est du JSON, on vérifie que les en-têtes CORS sont présents
76
+ const corsHeaders = response.headers.get('access-control-allow-origin');
77
+ if (!corsHeaders) {
78
+ console.warn('Attention: En-têtes CORS manquants dans la réponse JSON');
79
+ }
80
+ }
71
81
  return response;
72
82
  }
73
83
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"customFetch.d.ts","sourceRoot":"","sources":["../../src/lib/customFetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAsC9C,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAC3G,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA"}
1
+ {"version":3,"file":"customFetch.d.ts","sourceRoot":"","sources":["../../src/lib/customFetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAkD9C,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAC3G,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA"}
package/dist/module.js CHANGED
@@ -52,14 +52,24 @@ const fetchData = (url, signal) => __awaiter(void 0, void 0, void 0, function* (
52
52
  'Content-Type': 'application/json',
53
53
  },
54
54
  mode: 'cors',
55
- credentials: 'omit',
55
+ credentials: 'same-origin',
56
56
  cache: 'no-cache',
57
57
  redirect: 'follow',
58
58
  referrerPolicy: 'no-referrer',
59
59
  });
60
+ console.log('RESPONSE', response);
60
61
  if (!response.ok) {
61
62
  throw new Error(`Erreur HTTP: ${response.status} - ${response.statusText}`);
62
63
  }
64
+ // Vérification des en-têtes de réponse
65
+ const contentType = response.headers.get('content-type');
66
+ if (contentType && contentType.includes('application/json')) {
67
+ // Si c'est du JSON, on vérifie que les en-têtes CORS sont présents
68
+ const corsHeaders = response.headers.get('access-control-allow-origin');
69
+ if (!corsHeaders) {
70
+ console.warn('Attention: En-têtes CORS manquants dans la réponse JSON');
71
+ }
72
+ }
63
73
  return response;
64
74
  }
65
75
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretto/places",
3
- "version": "0.43.0",
3
+ "version": "0.45.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -16,6 +16,7 @@
16
16
  "dist/**/*"
17
17
  ],
18
18
  "dependencies": {
19
+ "@pretto/places": "^0.43.0",
19
20
  "@types/algoliasearch": "^4.0.0",
20
21
  "algoliasearch": "4.22.1",
21
22
  "array.prototype.flat": "^1.3.0",