@pplancq/react-template 1.4.0 → 1.5.1
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/CHANGELOG.md +25 -0
- package/package.json +19 -16
- package/src/api/constant.ts +1 -1
- package/src/api/fetchApi.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
## @pplancq/react-template [1.5.1](https://github.com/pplancq/dev-tools/compare/@pplancq/react-template@1.5.0...@pplancq/react-template@1.5.1) (2024-06-04)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **react-template:** fix typo in fetch contanst ([05ca8ce](https://github.com/pplancq/dev-tools/commit/05ca8ce81440d9ced56ecbd6307ff43ca85df848))
|
|
6
|
+
|
|
7
|
+
## @pplancq/react-template [1.5.0](https://github.com/pplancq/dev-tools/compare/@pplancq/react-template@1.4.0...@pplancq/react-template@1.5.0) (2024-05-06)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **dev-tools:** add minimal nodejs versions for each package ([0d8447a](https://github.com/pplancq/dev-tools/commit/0d8447a6f4e26ff9cb28baac8434020156d5dac0))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* **@pplancq/babel-config:** upgraded to 1.1.0
|
|
19
|
+
* **@pplancq/commitlint-config:** upgraded to 2.2.0
|
|
20
|
+
* **@pplancq/eslint-config:** upgraded to 2.2.0
|
|
21
|
+
* **@pplancq/postcss-config:** upgraded to 1.1.0
|
|
22
|
+
* **@pplancq/prettier-config:** upgraded to 1.1.0
|
|
23
|
+
* **@pplancq/stylelint-config:** upgraded to 2.1.0
|
|
24
|
+
* **@pplancq/webpack-config:** upgraded to 1.4.0
|
|
25
|
+
|
|
1
26
|
## @pplancq/react-template [1.4.0](https://github.com/pplancq/dev-tools/compare/@pplancq/react-template@1.3.0...@pplancq/react-template@1.4.0) (2024-05-02)
|
|
2
27
|
|
|
3
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pplancq/react-template",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "react template",
|
|
6
6
|
"author": "pplancq <paul.plancq@outlook.fr>",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"template"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@hookform/resolvers": "^3.
|
|
37
|
-
"@tanstack/react-query": "^5.
|
|
38
|
-
"@tanstack/react-query-devtools": "^5.
|
|
36
|
+
"@hookform/resolvers": "^3.4.2",
|
|
37
|
+
"@tanstack/react-query": "^5.40.0",
|
|
38
|
+
"@tanstack/react-query-devtools": "^5.40.0",
|
|
39
39
|
"react": "^18.2.0",
|
|
40
40
|
"react-dom": "^18.3.1",
|
|
41
|
-
"react-hook-form": "^7.51.
|
|
42
|
-
"react-router-dom": "^6.23.
|
|
41
|
+
"react-hook-form": "^7.51.5",
|
|
42
|
+
"react-router-dom": "^6.23.1",
|
|
43
43
|
"yup": "^1.4.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -51,21 +51,21 @@
|
|
|
51
51
|
"@pplancq/prettier-config": "*",
|
|
52
52
|
"@pplancq/stylelint-config": "*",
|
|
53
53
|
"@pplancq/webpack-config": "*",
|
|
54
|
-
"@testing-library/jest-dom": "^6.
|
|
55
|
-
"@testing-library/react": "^15.0.
|
|
54
|
+
"@testing-library/jest-dom": "^6.4.5",
|
|
55
|
+
"@testing-library/react": "^15.0.7",
|
|
56
56
|
"@testing-library/user-event": "^14.5.1",
|
|
57
|
-
"@types/react": "^18.
|
|
57
|
+
"@types/react": "^18.3.3",
|
|
58
58
|
"@types/react-dom": "^18.3.0",
|
|
59
|
-
"@vitejs/plugin-react": "^4.
|
|
60
|
-
"@vitest/coverage-v8": "^1.
|
|
59
|
+
"@vitejs/plugin-react": "^4.3.0",
|
|
60
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
61
61
|
"concurrently": "^8.2.2",
|
|
62
62
|
"eslint": "^8.57.0",
|
|
63
63
|
"eslint-plugin-prettier": "^5.1.3",
|
|
64
64
|
"husky": "^9.0.11",
|
|
65
|
-
"jsdom": "^24.
|
|
66
|
-
"lint-staged": "^15.2.
|
|
67
|
-
"prettier": "^3.
|
|
68
|
-
"stylelint": "^16.
|
|
65
|
+
"jsdom": "^24.1.0",
|
|
66
|
+
"lint-staged": "^15.2.5",
|
|
67
|
+
"prettier": "^3.3.0",
|
|
68
|
+
"stylelint": "^16.6.1",
|
|
69
69
|
"stylelint-prettier": "^5.0.0",
|
|
70
70
|
"tsc-files": "^1.1.4",
|
|
71
71
|
"typescript": "^5.4.5",
|
|
@@ -76,7 +76,10 @@
|
|
|
76
76
|
"vitest-sonar-reporter": "^2.0.0",
|
|
77
77
|
"webpack": "^5.91.0",
|
|
78
78
|
"webpack-cli": "^5.1.4",
|
|
79
|
-
"webpack-dev-server": "^
|
|
79
|
+
"webpack-dev-server": "^5.0.4"
|
|
80
|
+
},
|
|
81
|
+
"engines": {
|
|
82
|
+
"node": ">=20.12.2"
|
|
80
83
|
},
|
|
81
84
|
"volta": {
|
|
82
85
|
"node": "20.12.2",
|
package/src/api/constant.ts
CHANGED
package/src/api/fetchApi.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Json } from '@Front/types/api';
|
|
2
|
-
import { HEADERS, METHODS,
|
|
2
|
+
import { HEADERS, METHODS, MIME_TYPES } from './constant';
|
|
3
3
|
|
|
4
4
|
export type FetchApiError = Error & {
|
|
5
5
|
code?: number;
|
|
6
|
-
contentType?:
|
|
6
|
+
contentType?: MIME_TYPES;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
type FetchApiProps = {
|
|
@@ -22,7 +22,7 @@ export const fetchApi = async <T extends Json | string>({
|
|
|
22
22
|
const mergeHeaders = new Headers(headers);
|
|
23
23
|
|
|
24
24
|
if (data) {
|
|
25
|
-
mergeHeaders.append(HEADERS.contentType,
|
|
25
|
+
mergeHeaders.append(HEADERS.contentType, MIME_TYPES.json);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const response = await fetch(path, {
|
|
@@ -36,7 +36,7 @@ export const fetchApi = async <T extends Json | string>({
|
|
|
36
36
|
if (!response.ok) {
|
|
37
37
|
const error: FetchApiError = new Error(content);
|
|
38
38
|
error.code = response.status;
|
|
39
|
-
error.contentType = (response.headers.get(HEADERS.contentType) as
|
|
39
|
+
error.contentType = (response.headers.get(HEADERS.contentType) as MIME_TYPES) ?? MIME_TYPES.text;
|
|
40
40
|
|
|
41
41
|
throw error;
|
|
42
42
|
}
|