@zac-apps/commons 1.3.5-beta.1 → 1.3.5-beta.3

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.
Files changed (3) hide show
  1. package/README.md +1 -36
  2. package/dist/index.js +37 -15
  3. package/package.json +12 -12
package/README.md CHANGED
@@ -1,36 +1 @@
1
- This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2
-
3
- ## Getting Started
4
-
5
- First, run the development server:
6
-
7
- ```bash
8
- npm run dev
9
- # or
10
- yarn dev
11
- # or
12
- pnpm dev
13
- # or
14
- bun dev
15
- ```
16
-
17
- Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
-
19
- You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file.
20
-
21
- This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
22
-
23
- ## Learn More
24
-
25
- To learn more about Next.js, take a look at the following resources:
26
-
27
- - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28
- - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29
-
30
- You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31
-
32
- ## Deploy on Vercel
33
-
34
- The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35
-
36
- Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
1
+ This package contains common components for the ZAC Apps
package/dist/index.js CHANGED
@@ -439,34 +439,56 @@ function PublicFetch(_ref) {
439
439
  SetMetaData = _ref.SetMetaData,
440
440
  reload = _ref.reload,
441
441
  SetReload = _ref.SetReload;
442
+ _ref.error;
443
+ var SetError = _ref.SetError;
442
444
  var _useState = useState(),
443
445
  _useState2 = _slicedToArray(_useState, 2),
444
446
  internal = _useState2[0],
445
447
  SetInternal = _useState2[1];
448
+ var _useState3 = useState(),
449
+ _useState4 = _slicedToArray(_useState3, 2);
450
+ _useState4[0];
451
+ var SetInternalError = _useState4[1];
446
452
  var state = null;
447
453
  if (!SetState) {
448
454
  SetState = SetInternal;
449
455
  state = internal;
450
456
  }
457
+ if (!SetError) {
458
+ SetError = SetInternalError;
459
+ }
451
460
  if (!reload) {
452
461
  reload = false;
453
462
  }
454
463
  useEffect(function () {
455
- fetch(url, {
456
- headers: {
457
- "Content-Type": "application/json",
458
- Accept: "application/json"
459
- }
460
- }).then(function (response) {
461
- if (SetMetaData) {
462
- SetMetaData(response.headers);
463
- }
464
- console.log(response);
465
- return response.json();
466
- }).then(function (json) {
467
- console.log(json);
468
- SetState(json);
469
- });
464
+ try {
465
+ fetch(url, {
466
+ headers: {
467
+ "Content-Type": "application/json",
468
+ Accept: "application/json"
469
+ }
470
+ }).then(function (response) {
471
+ if (SetMetaData) {
472
+ SetMetaData(response.headers);
473
+ }
474
+ console.log(response);
475
+ if (!response.ok) {
476
+ return {
477
+ error: response.statusText
478
+ };
479
+ } else {
480
+ return response.json();
481
+ }
482
+ }).then(function (json) {
483
+ console.log(json);
484
+ SetState(json);
485
+ });
486
+ } catch (e) {
487
+ console.log(e);
488
+ SetError({
489
+ error: e
490
+ });
491
+ }
470
492
  if (SetReload) {
471
493
  SetReload(false);
472
494
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zac-apps/commons",
3
- "version": "1.3.5-beta.1",
3
+ "version": "1.3.5-beta.3",
4
4
  "scripts": {
5
5
  "rollup": "node_modules/rollup/dist/rollup.js",
6
6
  "dev": "next dev",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "repository": {
22
22
  "type": "git",
23
- "url": "https://gitlab.rlp.net/liermann/zac-apps-commons.git"
23
+ "url": "https://gitlab.rlp.net/zac/zac-apps-commons.git"
24
24
  },
25
25
  "keywords": [
26
26
  "JGU"
@@ -42,21 +42,21 @@
42
42
  "@semantic-release/git": "^10.0.1",
43
43
  "@semantic-release/gitlab": "^13.0.3",
44
44
  "@semantic-release/npm": "^12.0.0",
45
- "@storybook/addon-essentials": "^8.0.4",
46
- "@storybook/addon-interactions": "^8.0.4",
47
- "@storybook/addon-links": "^8.0.4",
48
- "@storybook/addon-onboarding": "^8.0.4",
49
- "@storybook/blocks": "^8.0.4",
50
- "@storybook/nextjs": "^8.0.4",
51
- "@storybook/react": "^8.0.4",
52
- "@storybook/test": "^8.0.4",
45
+ "@storybook/addon-essentials": "^8.0.5",
46
+ "@storybook/addon-interactions": "^8.0.5",
47
+ "@storybook/addon-links": "^8.0.5",
48
+ "@storybook/addon-onboarding": "^8.0.5",
49
+ "@storybook/blocks": "^8.0.5",
50
+ "@storybook/nextjs": "^8.0.5",
51
+ "@storybook/react": "^8.0.5",
52
+ "@storybook/test": "^8.0.5",
53
53
  "babel-loader": "^9.1.3",
54
54
  "eslint": "^8",
55
55
  "eslint-config-next": "14.1.4",
56
56
  "eslint-plugin-storybook": "^0.8.0",
57
- "rollup": "^4.13.0",
57
+ "rollup": "^4.13.1",
58
58
  "semantic-release": "^23.0.6",
59
- "storybook": "^8.0.4"
59
+ "storybook": "^8.0.5"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "next": "^14.0.4",