payload 1.1.27-beta.0 → 1.2.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/CHANGELOG.md +14 -39
- package/dist/admin/components/Routes.js +1 -1
- package/dist/admin/components/elements/Autosave/index.js +2 -2
- package/dist/admin/components/elements/DeleteDocument/index.js +1 -0
- package/dist/admin/components/elements/DuplicateDocument/index.js +5 -5
- package/dist/admin/components/elements/Status/index.js +3 -2
- package/dist/admin/components/elements/WhereBuilder/Condition/Relationship/index.js +2 -2
- package/dist/admin/components/forms/Form/buildStateFromSchema/addFieldStatePromise.d.ts +3 -3
- package/dist/admin/components/forms/Form/buildStateFromSchema/addFieldStatePromise.js +7 -7
- package/dist/admin/components/forms/Form/buildStateFromSchema/index.d.ts +2 -2
- package/dist/admin/components/forms/Form/buildStateFromSchema/index.js +2 -2
- package/dist/admin/components/forms/Form/buildStateFromSchema/iterateFields.d.ts +3 -3
- package/dist/admin/components/forms/Form/buildStateFromSchema/iterateFields.js +2 -2
- package/dist/admin/components/forms/Form/index.js +8 -4
- package/dist/admin/components/forms/field-types/Array/index.js +2 -2
- package/dist/admin/components/forms/field-types/Blocks/index.js +2 -2
- package/dist/admin/components/forms/field-types/Relationship/AddNew/Modal/index.js +2 -2
- package/dist/admin/components/forms/field-types/Relationship/index.js +2 -2
- package/dist/admin/components/forms/field-types/RichText/elements/link/Button.js +2 -2
- package/dist/admin/components/forms/field-types/RichText/elements/link/Element.js +3 -3
- package/dist/admin/components/forms/field-types/RichText/elements/relationship/Button/index.js +1 -1
- package/dist/admin/components/forms/field-types/RichText/elements/upload/Element/EditModal/index.js +2 -2
- package/dist/admin/components/forms/field-types/Upload/Input.js +1 -1
- package/dist/admin/components/forms/useField/index.js +2 -2
- package/dist/admin/components/utilities/Auth/index.js +9 -5
- package/dist/admin/components/utilities/DocumentInfo/index.js +3 -3
- package/dist/admin/components/utilities/I18n/index.js +4 -1
- package/dist/admin/components/utilities/Preferences/index.js +2 -2
- package/dist/admin/components/views/Account/index.js +4 -4
- package/dist/admin/components/views/Global/index.js +5 -5
- package/dist/admin/components/views/Verify/index.js +1 -1
- package/dist/admin/components/views/Version/Compare/index.js +1 -1
- package/dist/admin/components/views/Version/Restore/index.js +6 -2
- package/dist/admin/components/views/collections/Edit/Auth/APIKey.js +2 -2
- package/dist/admin/components/views/collections/Edit/Auth/index.js +1 -1
- package/dist/admin/components/views/collections/Edit/Default.js +3 -2
- package/dist/admin/components/views/collections/Edit/index.js +4 -4
- package/dist/admin/components/views/collections/List/RelationshipProvider/index.js +1 -1
- package/dist/admin/hooks/usePayloadAPI.js +1 -1
- package/dist/auth/executeAccess.js +3 -3
- package/dist/auth/getExecuteStaticAccess.js +2 -2
- package/dist/auth/operations/forgotPassword.js +5 -5
- package/dist/auth/operations/local/forgotPassword.js +3 -1
- package/dist/auth/operations/local/login.js +3 -1
- package/dist/auth/operations/local/resetPassword.js +3 -1
- package/dist/auth/operations/local/unlock.js +3 -1
- package/dist/auth/operations/login.js +4 -4
- package/dist/auth/operations/logout.js +2 -2
- package/dist/auth/operations/refresh.js +2 -2
- package/dist/auth/operations/registerFirstUser.js +2 -2
- package/dist/auth/sendVerificationEmail.js +3 -3
- package/dist/collections/operations/create.js +4 -4
- package/dist/collections/operations/delete.js +6 -6
- package/dist/collections/operations/findByID.js +4 -4
- package/dist/collections/operations/findVersionByID.js +5 -5
- package/dist/collections/operations/local/create.js +3 -1
- package/dist/collections/operations/local/delete.js +3 -1
- package/dist/collections/operations/local/find.js +3 -1
- package/dist/collections/operations/local/findByID.js +3 -1
- package/dist/collections/operations/local/findVersionByID.js +3 -1
- package/dist/collections/operations/local/findVersions.js +5 -2
- package/dist/collections/operations/local/restoreVersion.js +4 -2
- package/dist/collections/operations/local/update.js +5 -2
- package/dist/collections/operations/restoreVersion.js +5 -5
- package/dist/collections/operations/update.js +6 -6
- package/dist/collections/requestHandlers/create.js +2 -2
- package/dist/collections/requestHandlers/delete.js +2 -2
- package/dist/collections/requestHandlers/restoreVersion.js +2 -2
- package/dist/collections/requestHandlers/update.js +4 -4
- package/dist/errors/AuthenticationError.d.ts +2 -2
- package/dist/errors/AuthenticationError.js +3 -3
- package/dist/errors/ErrorDeletingFile.d.ts +2 -2
- package/dist/errors/ErrorDeletingFile.js +3 -3
- package/dist/errors/FileUploadError.d.ts +2 -2
- package/dist/errors/FileUploadError.js +3 -3
- package/dist/errors/Forbidden.d.ts +2 -2
- package/dist/errors/Forbidden.js +3 -3
- package/dist/errors/LockedAuth.d.ts +2 -2
- package/dist/errors/LockedAuth.js +3 -3
- package/dist/errors/MissingFile.d.ts +2 -2
- package/dist/errors/MissingFile.js +3 -3
- package/dist/errors/NotFound.d.ts +2 -2
- package/dist/errors/NotFound.js +3 -3
- package/dist/errors/UnathorizedError.d.ts +2 -2
- package/dist/errors/UnathorizedError.js +3 -3
- package/dist/errors/ValidationError.d.ts +2 -2
- package/dist/errors/ValidationError.js +3 -3
- package/dist/express/middleware/i18n.js +3 -3
- package/dist/express/types.d.ts +2 -1
- package/dist/fields/config/schema.js +4 -1
- package/dist/fields/config/types.d.ts +5 -2
- package/dist/fields/config/types.js +1 -1
- package/dist/fields/hooks/beforeChange/index.js +2 -2
- package/dist/fields/hooks/beforeChange/promise.js +2 -2
- package/dist/fields/validations.js +51 -51
- package/dist/fields/validations.spec.js +2 -3
- package/dist/globals/operations/findVersionByID.js +5 -5
- package/dist/globals/operations/local/findOne.js +5 -1
- package/dist/globals/operations/local/findVersionByID.js +5 -1
- package/dist/globals/operations/local/findVersions.js +5 -1
- package/dist/globals/operations/local/restoreVersion.js +5 -1
- package/dist/globals/operations/local/update.js +5 -1
- package/dist/globals/operations/restoreVersion.js +3 -3
- package/dist/globals/requestHandlers/restoreVersion.js +2 -2
- package/dist/globals/requestHandlers/update.js +4 -4
- package/dist/graphql/schema/buildBlockType.js +3 -3
- package/dist/preferences/operations/delete.js +2 -2
- package/dist/preferences/operations/findOne.js +2 -2
- package/dist/preferences/operations/update.js +2 -2
- package/dist/preferences/requestHandlers/delete.js +2 -2
- package/dist/preferences/requestHandlers/findOne.js +2 -2
- package/dist/preferences/requestHandlers/update.js +2 -2
- package/dist/translations/init.d.ts +2 -2
- package/dist/translations/init.js +4 -1
- package/dist/uploads/generateFileData.js +3 -3
- package/dist/uploads/uploadFiles.d.ts +2 -2
- package/dist/uploads/uploadFiles.js +3 -3
- package/docs/configuration/i18n.mdx +1 -1
- package/docs/fields/blocks.mdx +23 -22
- package/docs/fields/overview.mdx +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,67 +1,42 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# [1.2.0](https://github.com/payloadcms/payload/compare/v1.1.26...v1.2.0) (2022-11-18)
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
### Bug Fixes
|
|
7
7
|
|
|
8
|
-
* allow label to be set to false ([858fc86](https://github.com/payloadcms/payload/commit/858fc86af895f25a091f1b5b729d04c86f654601))
|
|
9
|
-
* autosave slug regression ([b1f3ce9](https://github.com/payloadcms/payload/commit/b1f3ce9735743b8056633d98fb94353e6f4c08e6))
|
|
10
8
|
* build errors ([65f0e1c](https://github.com/payloadcms/payload/commit/65f0e1caace193f034139e331883d01d8eb92d2c))
|
|
11
9
|
* components optional chaining ([d5e725c](https://github.com/payloadcms/payload/commit/d5e725c608588e96b974291fa86d5e89dea9060d))
|
|
12
10
|
* corrects exported custom component type ([2878b4b](https://github.com/payloadcms/payload/commit/2878b4b1bec5c0c9997c1ba2a080640d4d3f8e5f))
|
|
13
11
|
* corrects type for CollapsibleLabel example type, adjusts custom component filenames ([ccb4231](https://github.com/payloadcms/payload/commit/ccb42319abf0679d998e15b6b47fff3ce95d4ca1))
|
|
14
|
-
* getTranslation fallback ([d82a6be](https://github.com/payloadcms/payload/commit/d82a6be5012a355d0eed98ac57c79a6f1d3c7f32))
|
|
15
|
-
* radio and select fields show translated value in list view ([13d225f](https://github.com/payloadcms/payload/commit/13d225ff086c8913a8954dd83e658af5859028bc))
|
|
16
12
|
* sets pointer-events to none so the entire label bar is clickable ([e458087](https://github.com/payloadcms/payload/commit/e458087a55cbbad29ca3568ca4c089aaee49693a))
|
|
17
|
-
* translation formatting ([d9ddca9](https://github.com/payloadcms/payload/commit/d9ddca9d1b7276a1ed3603ceb78399bd45624032))
|
|
18
|
-
* translation typos ([0ed38d4](https://github.com/payloadcms/payload/commit/0ed38d47081b351e70854cc11bdb0efe1ec971ac))
|
|
19
|
-
* type error ([6a5bd24](https://github.com/payloadcms/payload/commit/6a5bd24fd125464522b9d27e724efa435fb621a4))
|
|
20
13
|
|
|
21
14
|
|
|
22
15
|
### Features
|
|
23
16
|
|
|
24
|
-
* add
|
|
25
|
-
* Add french translations ([#1421](https://github.com/payloadcms/payload/issues/1421)) ([118886e](https://github.com/payloadcms/payload/commit/118886e2ef073464fde432243a9205ce92762282))
|
|
26
|
-
* add i18n to admin panel ([d910045](https://github.com/payloadcms/payload/commit/d910045102b2e80c12c96f13941d8d624abbecf5))
|
|
27
|
-
* add i18n to local api ([f143f72](https://github.com/payloadcms/payload/commit/f143f724fee85b51697ad54110a0920a398baced))
|
|
28
|
-
* Add Italian Translations ([#1335](https://github.com/payloadcms/payload/issues/1335)) ([97c28c8](https://github.com/payloadcms/payload/commit/97c28c809614962a1be795082ed84dbfc2299e79))
|
|
29
|
-
* Add Japanese Translations ([#1351](https://github.com/payloadcms/payload/issues/1351)) ([522576c](https://github.com/payloadcms/payload/commit/522576c2b98368f14fe0bf945c703f866bb7646b))
|
|
30
|
-
* add language select input to account ([ccee1d8](https://github.com/payloadcms/payload/commit/ccee1d84d4247dc894bf15227728cbb29f924d21))
|
|
31
|
-
* add polish translations ([#1328](https://github.com/payloadcms/payload/issues/1328)) ([7e218fe](https://github.com/payloadcms/payload/commit/7e218feb911bcda312f2732266a63c3eccb285a2))
|
|
32
|
-
* Add Russian Translations ([#1334](https://github.com/payloadcms/payload/issues/1334)) ([9980765](https://github.com/payloadcms/payload/commit/99807657ba97d68c5d3457794745d4182715abfa))
|
|
33
|
-
* Add Spanish Translations ([#1327](https://github.com/payloadcms/payload/issues/1327)) ([edf6877](https://github.com/payloadcms/payload/commit/edf687792489fbc969ba0a0f0f6aab69f637cebe))
|
|
34
|
-
* Add swedish translations ([#1429](https://github.com/payloadcms/payload/issues/1429)) ([ba8f739](https://github.com/payloadcms/payload/commit/ba8f7390cabc514735c76c32266be792b0f4596d))
|
|
35
|
-
* add Vietnamese translation for the admin panel ([#1346](https://github.com/payloadcms/payload/issues/1346)) ([47f45fa](https://github.com/payloadcms/payload/commit/47f45fae150779ec319bbb35b91469baaa308688))
|
|
17
|
+
* add i18n to admin panel ([#1326](https://github.com/payloadcms/payload/issues/1326)) ([bab34d8](https://github.com/payloadcms/payload/commit/bab34d82f5fddad32ceafd116ad97e87cab4c862))
|
|
36
18
|
* adds docs example ([2bf0fff](https://github.com/payloadcms/payload/commit/2bf0fffa0dd83f395aa3318b3baba1e22dd58b51))
|
|
37
19
|
* adds playwright tests for array fields ([57a8c35](https://github.com/payloadcms/payload/commit/57a8c352e44750d1785b65074c15812dc8226585))
|
|
38
|
-
* allow custom translations in payload config ([16d1c53](https://github.com/payloadcms/payload/commit/16d1c53b8d18c2924644103713b4d785757764dd))
|
|
39
|
-
* collection and globals description support i18n ([f39898b](https://github.com/payloadcms/payload/commit/f39898b784cd1fe252fdaeaf97d242a3afef2f36))
|
|
40
20
|
* converts rowHeader to collapsibleLabel, extends data passed to functions/components ([13ec1e0](https://github.com/payloadcms/payload/commit/13ec1e0398d2a9ce1aeddc5692008173acfde45e))
|
|
41
21
|
* customizable header-labels ([d45de99](https://github.com/payloadcms/payload/commit/d45de99956273c59e6d1a3a11c7cce36f3d123f6))
|
|
42
|
-
* fields translations ([a7008de](https://github.com/payloadcms/payload/commit/a7008def47d8701d371d0f312148d98259a607d4))
|
|
43
|
-
* GraphQL schema uses names and slugs instead of labels, introduces graphQL names for compatibility ([508faa0](https://github.com/payloadcms/payload/commit/508faa05b20adfd5d218dbb4cb56db890e8c4345))
|
|
44
|
-
* i18n base field labels ([fd675f9](https://github.com/payloadcms/payload/commit/fd675f9341bbd9461c418a03ed837c577fdb1ed9))
|
|
45
|
-
* i18n errors ([25294d1](https://github.com/payloadcms/payload/commit/25294d1e8b10d7e516fda5894062836fc9ae312f))
|
|
46
|
-
* i18n labels blocks ([650d8ab](https://github.com/payloadcms/payload/commit/650d8aba0efe4ddd9e561b78d932fe250be077a4))
|
|
47
|
-
* i18n labels, descriptions, placeholders, tabs and nav groups ([ca18afc](https://github.com/payloadcms/payload/commit/ca18afcd994bb3b56548b9c6e10e81907e2542ef))
|
|
48
|
-
* i18n translated auth emails, request handlers, operations ([4c6847d](https://github.com/payloadcms/payload/commit/4c6847d303c38c34f31c1508ba52e80828aef733))
|
|
49
|
-
* make translations for german language ([#1331](https://github.com/payloadcms/payload/issues/1331)) ([cdfcd0f](https://github.com/payloadcms/payload/commit/cdfcd0f216e40654234e331d47e47bd70f08c459))
|
|
50
|
-
* make typescript interface configurable for globals and collections and default to slugs instead of labels ([1ecf2a9](https://github.com/payloadcms/payload/commit/1ecf2a9a06fa334dd9af31600bdefa73d9c0410b))
|
|
51
|
-
* nav group translations ([a61748a](https://github.com/payloadcms/payload/commit/a61748a233f968c6b339d3816b0497a459791ac0))
|
|
52
22
|
* simplifies collapsible label API, adds e2e tests ([d9df98f](https://github.com/payloadcms/payload/commit/d9df98ff22041908fc2ce0972c844116edd409be))
|
|
53
23
|
* specifies component names for arrays/collapsibles, simplifies threaded data ([b74ea21](https://github.com/payloadcms/payload/commit/b74ea218ca47ce9db9d20586dbbce73e4ce0f917))
|
|
54
|
-
* translation of elements ([3820840](https://github.com/payloadcms/payload/commit/382084051db5d09b95eef1731b3f94708c5caace))
|
|
55
|
-
* translation of views ([9d966cf](https://github.com/payloadcms/payload/commit/9d966cf368a42254e0900f997f2def4a0d972b14))
|
|
56
|
-
* translations upload and list ([3d88b61](https://github.com/payloadcms/payload/commit/3d88b618fa3bd5cc5288b05b6ffc1bc25caf9150))
|
|
57
|
-
* translations: authentication, upload, edit, theme ([24d356e](https://github.com/payloadcms/payload/commit/24d356e3f662ad3288b17439b62fc8a6cf3d9552))
|
|
58
|
-
* validation i18n ([cd38e9d](https://github.com/payloadcms/payload/commit/cd38e9d8ac4ea53112a698e5596f158b464354a0))
|
|
59
24
|
|
|
60
25
|
|
|
61
26
|
### BREAKING CHANGES
|
|
62
27
|
|
|
63
|
-
* labels
|
|
64
|
-
|
|
28
|
+
* If you assigned labels to collections, globals or block names, you need to update your config! Your GraphQL schema and generated Typescript interfaces may have changed. Payload no longer uses labels for code based naming. To prevent breaking changes to your GraphQL API and typescript types in your project, you can assign the below properties to match what Payload previously generated for you from labels.
|
|
29
|
+
|
|
30
|
+
On Collections
|
|
31
|
+
Use `graphQL.singularName`, `graphQL.pluralName` for GraphQL schema names.
|
|
32
|
+
Use `typescript.interface` for typescript generation name.
|
|
33
|
+
|
|
34
|
+
On Globals
|
|
35
|
+
Use `graphQL.name` for GraphQL Schema name.
|
|
36
|
+
Use `typescript.interface` for typescript generation name.
|
|
37
|
+
|
|
38
|
+
On Blocks (within Block fields)
|
|
39
|
+
Use `graphQL.singularName` for graphQL schema names.
|
|
65
40
|
|
|
66
41
|
## [1.1.26](https://github.com/payloadcms/payload/compare/v1.1.25...v1.1.26) (2022-11-15)
|
|
67
42
|
|
|
@@ -36,7 +36,7 @@ const Routes = () => {
|
|
|
36
36
|
if (!userCollection.auth.disableLocalStrategy) {
|
|
37
37
|
requests.get(`${routes.api}/${slug}/init`, {
|
|
38
38
|
headers: {
|
|
39
|
-
'
|
|
39
|
+
'Accept-Language': i18n.language,
|
|
40
40
|
},
|
|
41
41
|
}).then((res) => res.json().then((data) => {
|
|
42
42
|
if (data && 'initialized' in data) {
|
|
@@ -38,7 +38,7 @@ const Autosave = ({ collection, global, id, publishedDocUpdatedAt }) => {
|
|
|
38
38
|
credentials: 'include',
|
|
39
39
|
headers: {
|
|
40
40
|
'Content-Type': 'application/json',
|
|
41
|
-
'
|
|
41
|
+
'Accept-Language': i18n.language,
|
|
42
42
|
},
|
|
43
43
|
body: JSON.stringify({}),
|
|
44
44
|
});
|
|
@@ -87,7 +87,7 @@ const Autosave = ({ collection, global, id, publishedDocUpdatedAt }) => {
|
|
|
87
87
|
credentials: 'include',
|
|
88
88
|
headers: {
|
|
89
89
|
'Content-Type': 'application/json',
|
|
90
|
-
'
|
|
90
|
+
'Accept-Language': i18n.language,
|
|
91
91
|
},
|
|
92
92
|
body: JSON.stringify(body),
|
|
93
93
|
});
|
|
@@ -35,7 +35,7 @@ const Duplicate = ({ slug, collection, id }) => {
|
|
|
35
35
|
depth: 0,
|
|
36
36
|
},
|
|
37
37
|
headers: {
|
|
38
|
-
'
|
|
38
|
+
'Accept-Language': i18n.language,
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
let data = await response.json();
|
|
@@ -48,7 +48,7 @@ const Duplicate = ({ slug, collection, id }) => {
|
|
|
48
48
|
const result = await requests.post(`${serverURL}${api}/${slug}`, {
|
|
49
49
|
headers: {
|
|
50
50
|
'Content-Type': 'application/json',
|
|
51
|
-
'
|
|
51
|
+
'Accept-Language': i18n.language,
|
|
52
52
|
},
|
|
53
53
|
body: JSON.stringify(data),
|
|
54
54
|
});
|
|
@@ -74,7 +74,7 @@ const Duplicate = ({ slug, collection, id }) => {
|
|
|
74
74
|
depth: 0,
|
|
75
75
|
},
|
|
76
76
|
headers: {
|
|
77
|
-
'
|
|
77
|
+
'Accept-Language': i18n.language,
|
|
78
78
|
},
|
|
79
79
|
});
|
|
80
80
|
let localizedDoc = await res.json();
|
|
@@ -87,7 +87,7 @@ const Duplicate = ({ slug, collection, id }) => {
|
|
|
87
87
|
const patchResult = await requests.patch(`${serverURL}${api}/${slug}/${duplicateID}?locale=${locale}`, {
|
|
88
88
|
headers: {
|
|
89
89
|
'Content-Type': 'application/json',
|
|
90
|
-
'
|
|
90
|
+
'Accept-Language': i18n.language,
|
|
91
91
|
},
|
|
92
92
|
body: JSON.stringify(localizedDoc),
|
|
93
93
|
});
|
|
@@ -102,7 +102,7 @@ const Duplicate = ({ slug, collection, id }) => {
|
|
|
102
102
|
// delete the duplicate doc to prevent incomplete
|
|
103
103
|
await requests.delete(`${serverURL}${api}/${slug}/${id}`, {
|
|
104
104
|
headers: {
|
|
105
|
-
'
|
|
105
|
+
'Accept-Language': i18n.language,
|
|
106
106
|
},
|
|
107
107
|
});
|
|
108
108
|
}
|
|
@@ -19,7 +19,7 @@ const Status = () => {
|
|
|
19
19
|
const [processing, setProcessing] = useState(false);
|
|
20
20
|
const { reset: resetForm } = useForm();
|
|
21
21
|
const locale = useLocale();
|
|
22
|
-
const { t } = useTranslation('version');
|
|
22
|
+
const { t, i18n } = useTranslation('version');
|
|
23
23
|
const unPublishModalSlug = `confirm-un-publish-${id}`;
|
|
24
24
|
const revertModalSlug = `confirm-revert-${id}`;
|
|
25
25
|
let statusToRender;
|
|
@@ -56,6 +56,7 @@ const Status = () => {
|
|
|
56
56
|
const res = await requests[method](url, {
|
|
57
57
|
headers: {
|
|
58
58
|
'Content-Type': 'application/json',
|
|
59
|
+
'Accept-Language': i18n.language,
|
|
59
60
|
},
|
|
60
61
|
body: JSON.stringify(body),
|
|
61
62
|
});
|
|
@@ -85,7 +86,7 @@ const Status = () => {
|
|
|
85
86
|
if (action === 'unpublish') {
|
|
86
87
|
toggleModal(unPublishModalSlug);
|
|
87
88
|
}
|
|
88
|
-
}, [collection, global, publishedDoc, serverURL, api, id, locale, resetForm, getVersions, t, toggleModal, revertModalSlug, unPublishModalSlug]);
|
|
89
|
+
}, [collection, global, publishedDoc, serverURL, api, id, i18n, locale, resetForm, getVersions, t, toggleModal, revertModalSlug, unPublishModalSlug]);
|
|
89
90
|
if (statusToRender) {
|
|
90
91
|
return (React.createElement("div", { className: baseClass },
|
|
91
92
|
React.createElement("div", { className: `${baseClass}__value-wrap` },
|
|
@@ -40,7 +40,7 @@ const RelationshipField = (props) => {
|
|
|
40
40
|
const response = await fetch(`${serverURL}${api}/${relation}?limit=${maxResultsPerRequest}&page=${lastLoadedPageToUse}&depth=0${searchParam}`, {
|
|
41
41
|
credentials: 'include',
|
|
42
42
|
headers: {
|
|
43
|
-
'
|
|
43
|
+
'Accept-Language': i18n.language,
|
|
44
44
|
},
|
|
45
45
|
});
|
|
46
46
|
if (response.ok) {
|
|
@@ -121,7 +121,7 @@ const RelationshipField = (props) => {
|
|
|
121
121
|
const response = await fetch(`${serverURL}${api}/${relation}/${id}?depth=0`, {
|
|
122
122
|
credentials: 'include',
|
|
123
123
|
headers: {
|
|
124
|
-
'
|
|
124
|
+
'Accept-Language': i18n.language,
|
|
125
125
|
},
|
|
126
126
|
});
|
|
127
127
|
if (response.ok) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TFunction } from 'i18next';
|
|
2
2
|
import { User } from '../../../../../auth';
|
|
3
3
|
import { NonPresentationalField } from '../../../../../fields/config/types';
|
|
4
4
|
import { Fields, Data } from '../types';
|
|
@@ -14,7 +14,7 @@ declare type Args = {
|
|
|
14
14
|
operation: 'create' | 'update';
|
|
15
15
|
data: Data;
|
|
16
16
|
fullData: Data;
|
|
17
|
-
|
|
17
|
+
t: TFunction;
|
|
18
18
|
};
|
|
19
|
-
export declare const addFieldStatePromise: ({ field, locale, user, state, path, passesCondition, fullData, data, fieldPromises, id, operation,
|
|
19
|
+
export declare const addFieldStatePromise: ({ field, locale, user, state, path, passesCondition, fullData, data, fieldPromises, id, operation, t, }: Args) => Promise<void>;
|
|
20
20
|
export {};
|
|
@@ -3,7 +3,7 @@ import ObjectID from 'bson-objectid';
|
|
|
3
3
|
import { fieldAffectsData, fieldHasSubFields, tabHasName, } from '../../../../../fields/config/types';
|
|
4
4
|
import getValueWithDefault from '../../../../../fields/getDefaultValue';
|
|
5
5
|
import { iterateFields } from './iterateFields';
|
|
6
|
-
export const addFieldStatePromise = async ({ field, locale, user, state, path, passesCondition, fullData, data, fieldPromises, id, operation,
|
|
6
|
+
export const addFieldStatePromise = async ({ field, locale, user, state, path, passesCondition, fullData, data, fieldPromises, id, operation, t, }) => {
|
|
7
7
|
var _a;
|
|
8
8
|
if (fieldAffectsData(field)) {
|
|
9
9
|
const fieldState = {
|
|
@@ -27,7 +27,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
|
|
|
27
27
|
siblingData: data,
|
|
28
28
|
id,
|
|
29
29
|
operation,
|
|
30
|
-
|
|
30
|
+
t,
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
if (typeof validationResult === 'string') {
|
|
@@ -59,7 +59,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
|
|
|
59
59
|
id,
|
|
60
60
|
locale,
|
|
61
61
|
operation,
|
|
62
|
-
|
|
62
|
+
t,
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
// Add values to field state
|
|
@@ -105,7 +105,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
|
|
|
105
105
|
operation,
|
|
106
106
|
fieldPromises,
|
|
107
107
|
id,
|
|
108
|
-
|
|
108
|
+
t,
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
});
|
|
@@ -132,7 +132,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
|
|
|
132
132
|
path: `${path}${field.name}.`,
|
|
133
133
|
locale,
|
|
134
134
|
user,
|
|
135
|
-
|
|
135
|
+
t,
|
|
136
136
|
});
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
@@ -159,7 +159,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
|
|
|
159
159
|
id,
|
|
160
160
|
locale,
|
|
161
161
|
operation,
|
|
162
|
-
|
|
162
|
+
t,
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
else if (field.type === 'tabs') {
|
|
@@ -176,7 +176,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
|
|
|
176
176
|
id,
|
|
177
177
|
locale,
|
|
178
178
|
operation,
|
|
179
|
-
|
|
179
|
+
t,
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
182
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TFunction } from 'i18next';
|
|
2
2
|
import { User } from '../../../../../auth';
|
|
3
3
|
import { Field as FieldSchema } from '../../../../../fields/config/types';
|
|
4
4
|
import { Fields, Data } from '../types';
|
|
@@ -10,7 +10,7 @@ declare type Args = {
|
|
|
10
10
|
id?: string | number;
|
|
11
11
|
operation?: 'create' | 'update';
|
|
12
12
|
locale: string;
|
|
13
|
-
|
|
13
|
+
t: TFunction;
|
|
14
14
|
};
|
|
15
15
|
declare const buildStateFromSchema: (args: Args) => Promise<Fields>;
|
|
16
16
|
export default buildStateFromSchema;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { iterateFields } from './iterateFields';
|
|
2
2
|
const buildStateFromSchema = async (args) => {
|
|
3
|
-
const { fieldSchema, data: fullData = {}, user, id, operation, locale,
|
|
3
|
+
const { fieldSchema, data: fullData = {}, user, id, operation, locale, t, } = args;
|
|
4
4
|
if (fieldSchema) {
|
|
5
5
|
const fieldPromises = [];
|
|
6
6
|
const state = {};
|
|
@@ -16,7 +16,7 @@ const buildStateFromSchema = async (args) => {
|
|
|
16
16
|
data: fullData,
|
|
17
17
|
fullData,
|
|
18
18
|
parentPassesCondition: true,
|
|
19
|
-
|
|
19
|
+
t,
|
|
20
20
|
});
|
|
21
21
|
await Promise.all(fieldPromises);
|
|
22
22
|
return state;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TFunction } from 'i18next';
|
|
2
2
|
import { User } from '../../../../../auth';
|
|
3
3
|
import { Field as FieldSchema } from '../../../../../fields/config/types';
|
|
4
4
|
import { Fields, Data } from '../types';
|
|
@@ -14,7 +14,7 @@ declare type Args = {
|
|
|
14
14
|
fieldPromises: Promise<void>[];
|
|
15
15
|
id: string | number;
|
|
16
16
|
operation: 'create' | 'update';
|
|
17
|
-
|
|
17
|
+
t: TFunction;
|
|
18
18
|
};
|
|
19
|
-
export declare const iterateFields: ({ fields, data, parentPassesCondition, path, fullData, user, locale, operation, fieldPromises, id, state,
|
|
19
|
+
export declare const iterateFields: ({ fields, data, parentPassesCondition, path, fullData, user, locale, operation, fieldPromises, id, state, t, }: Args) => void;
|
|
20
20
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fieldIsPresentationalOnly, } from '../../../../../fields/config/types';
|
|
2
2
|
import { addFieldStatePromise } from './addFieldStatePromise';
|
|
3
|
-
export const iterateFields = ({ fields, data, parentPassesCondition, path = '', fullData, user, locale, operation, fieldPromises, id, state,
|
|
3
|
+
export const iterateFields = ({ fields, data, parentPassesCondition, path = '', fullData, user, locale, operation, fieldPromises, id, state, t, }) => {
|
|
4
4
|
fields.forEach((field) => {
|
|
5
5
|
var _a, _b;
|
|
6
6
|
const initialData = data;
|
|
@@ -18,7 +18,7 @@ export const iterateFields = ({ fields, data, parentPassesCondition, path = '',
|
|
|
18
18
|
field,
|
|
19
19
|
passesCondition,
|
|
20
20
|
data,
|
|
21
|
-
|
|
21
|
+
t,
|
|
22
22
|
}));
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -65,7 +65,7 @@ const Form = (props) => {
|
|
|
65
65
|
user,
|
|
66
66
|
id,
|
|
67
67
|
operation,
|
|
68
|
-
|
|
68
|
+
t,
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
if (typeof validationResult === 'string') {
|
|
@@ -81,7 +81,7 @@ const Form = (props) => {
|
|
|
81
81
|
dispatchFields({ type: 'REPLACE_STATE', state: validatedFieldState });
|
|
82
82
|
}
|
|
83
83
|
return isValid;
|
|
84
|
-
}, [contextRef, id, user, operation,
|
|
84
|
+
}, [contextRef, id, user, operation, t, dispatchFields]);
|
|
85
85
|
const submit = useCallback(async (options = {}, e) => {
|
|
86
86
|
const { overrides = {}, action: actionToUse = action, method: methodToUse = method, skipValidation, } = options;
|
|
87
87
|
if (disabled) {
|
|
@@ -118,6 +118,9 @@ const Form = (props) => {
|
|
|
118
118
|
try {
|
|
119
119
|
const res = await requests[methodToUse.toLowerCase()](actionToUse, {
|
|
120
120
|
body: formData,
|
|
121
|
+
headers: {
|
|
122
|
+
'Accept-Language': i18n.language,
|
|
123
|
+
},
|
|
121
124
|
});
|
|
122
125
|
setModified(false);
|
|
123
126
|
if (typeof handleResponse === 'function') {
|
|
@@ -226,6 +229,7 @@ const Form = (props) => {
|
|
|
226
229
|
onSuccess,
|
|
227
230
|
redirect,
|
|
228
231
|
t,
|
|
232
|
+
i18n,
|
|
229
233
|
waitForAutocomplete,
|
|
230
234
|
]);
|
|
231
235
|
const getFields = useCallback(() => contextRef.current.fields, [contextRef]);
|
|
@@ -252,10 +256,10 @@ const Form = (props) => {
|
|
|
252
256
|
return formData;
|
|
253
257
|
}, [contextRef]);
|
|
254
258
|
const reset = useCallback(async (fieldSchema, data) => {
|
|
255
|
-
const state = await buildStateFromSchema({ fieldSchema, data, user, id, operation, locale,
|
|
259
|
+
const state = await buildStateFromSchema({ fieldSchema, data, user, id, operation, locale, t });
|
|
256
260
|
contextRef.current = { ...initContextState };
|
|
257
261
|
dispatchFields({ type: 'REPLACE_STATE', state });
|
|
258
|
-
}, [id, user, operation, locale,
|
|
262
|
+
}, [id, user, operation, locale, t, dispatchFields]);
|
|
259
263
|
contextRef.current.submit = submit;
|
|
260
264
|
contextRef.current.getFields = getFields;
|
|
261
265
|
contextRef.current.getField = getField;
|
|
@@ -63,14 +63,14 @@ const ArrayFieldType = (props) => {
|
|
|
63
63
|
disableFormData: (rows === null || rows === void 0 ? void 0 : rows.length) > 0,
|
|
64
64
|
});
|
|
65
65
|
const addRow = useCallback(async (rowIndex) => {
|
|
66
|
-
const subFieldState = await buildStateFromSchema({ fieldSchema: fields, operation, id, user, locale,
|
|
66
|
+
const subFieldState = await buildStateFromSchema({ fieldSchema: fields, operation, id, user, locale, t });
|
|
67
67
|
dispatchFields({ type: 'ADD_ROW', rowIndex, subFieldState, path });
|
|
68
68
|
dispatchRows({ type: 'ADD', rowIndex });
|
|
69
69
|
setModified(true);
|
|
70
70
|
setTimeout(() => {
|
|
71
71
|
scrollToID(`${path}-row-${rowIndex + 1}`);
|
|
72
72
|
}, 0);
|
|
73
|
-
}, [dispatchRows, dispatchFields, fields, path, operation, id, user, locale, setModified,
|
|
73
|
+
}, [dispatchRows, dispatchFields, fields, path, operation, id, user, locale, setModified, t]);
|
|
74
74
|
const duplicateRow = useCallback(async (rowIndex) => {
|
|
75
75
|
dispatchFields({ type: 'DUPLICATE_ROW', rowIndex, path });
|
|
76
76
|
dispatchRows({ type: 'ADD', rowIndex });
|
|
@@ -63,14 +63,14 @@ const BlocksField = (props) => {
|
|
|
63
63
|
}, []);
|
|
64
64
|
const addRow = useCallback(async (rowIndex, blockType) => {
|
|
65
65
|
const block = blocks.find((potentialBlock) => potentialBlock.slug === blockType);
|
|
66
|
-
const subFieldState = await buildStateFromSchema({ fieldSchema: block.fields, operation, id, user, locale,
|
|
66
|
+
const subFieldState = await buildStateFromSchema({ fieldSchema: block.fields, operation, id, user, locale, t });
|
|
67
67
|
dispatchFields({ type: 'ADD_ROW', rowIndex, subFieldState, path, blockType });
|
|
68
68
|
dispatchRows({ type: 'ADD', rowIndex, blockType });
|
|
69
69
|
setModified(true);
|
|
70
70
|
setTimeout(() => {
|
|
71
71
|
scrollToID(`${path}-row-${rowIndex + 1}`);
|
|
72
72
|
}, 0);
|
|
73
|
-
}, [blocks, operation, id, user, locale,
|
|
73
|
+
}, [blocks, operation, id, user, locale, t, dispatchFields, path, setModified]);
|
|
74
74
|
const duplicateRow = useCallback(async (rowIndex, blockType) => {
|
|
75
75
|
dispatchFields({ type: 'DUPLICATE_ROW', rowIndex, path });
|
|
76
76
|
dispatchRows({ type: 'ADD', rowIndex, blockType });
|
|
@@ -29,11 +29,11 @@ export const AddNewRelationModal = ({ modalCollection, onSave, modalSlug }) => {
|
|
|
29
29
|
const modalAction = `${serverURL}${api}/${modalCollection.slug}?locale=${locale}&depth=0&fallback-locale=null`;
|
|
30
30
|
useEffect(() => {
|
|
31
31
|
const buildState = async () => {
|
|
32
|
-
const state = await buildStateFromSchema({ fieldSchema: modalCollection.fields, data: {}, user, operation: 'create', locale,
|
|
32
|
+
const state = await buildStateFromSchema({ fieldSchema: modalCollection.fields, data: {}, user, operation: 'create', locale, t });
|
|
33
33
|
setInitialState(state);
|
|
34
34
|
};
|
|
35
35
|
buildState();
|
|
36
|
-
}, [modalCollection, locale, user,
|
|
36
|
+
}, [modalCollection, locale, user, t]);
|
|
37
37
|
useEffect(() => {
|
|
38
38
|
setIsAnimated(true);
|
|
39
39
|
}, []);
|
|
@@ -102,7 +102,7 @@ const Relationship = (props) => {
|
|
|
102
102
|
const response = await fetch(`${serverURL}${api}/${relation}?${qs.stringify(query)}`, {
|
|
103
103
|
credentials: 'include',
|
|
104
104
|
headers: {
|
|
105
|
-
'
|
|
105
|
+
'Accept-Language': i18n.language,
|
|
106
106
|
},
|
|
107
107
|
});
|
|
108
108
|
if (response.ok) {
|
|
@@ -225,7 +225,7 @@ const Relationship = (props) => {
|
|
|
225
225
|
const response = await fetch(`${serverURL}${api}/${relation}?${qs.stringify(query)}`, {
|
|
226
226
|
credentials: 'include',
|
|
227
227
|
headers: {
|
|
228
|
-
'
|
|
228
|
+
'Accept-Language': i18n.language,
|
|
229
229
|
},
|
|
230
230
|
});
|
|
231
231
|
const collection = collections.find((coll) => coll.slug === relation);
|
|
@@ -19,7 +19,7 @@ export const LinkButton = ({ fieldProps }) => {
|
|
|
19
19
|
var _a, _b;
|
|
20
20
|
const customFieldSchema = (_b = (_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.admin) === null || _a === void 0 ? void 0 : _a.link) === null || _b === void 0 ? void 0 : _b.fields;
|
|
21
21
|
const modalSlug = `${baseModalSlug}-${fieldProps.path}`;
|
|
22
|
-
const {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
23
|
const config = useConfig();
|
|
24
24
|
const editor = useSlate();
|
|
25
25
|
const { user } = useAuth();
|
|
@@ -61,7 +61,7 @@ export const LinkButton = ({ fieldProps }) => {
|
|
|
61
61
|
const data = {
|
|
62
62
|
text: editor.selection ? Editor.string(editor, editor.selection) : '',
|
|
63
63
|
};
|
|
64
|
-
const state = await buildStateFromSchema({ fieldSchema, data, user, operation: 'create', locale,
|
|
64
|
+
const state = await buildStateFromSchema({ fieldSchema, data, user, operation: 'create', locale, t });
|
|
65
65
|
setInitialState(state);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -25,7 +25,7 @@ export const LinkElement = ({ attributes, children, element, editorRef, fieldPro
|
|
|
25
25
|
const config = useConfig();
|
|
26
26
|
const { user } = useAuth();
|
|
27
27
|
const locale = useLocale();
|
|
28
|
-
const { t
|
|
28
|
+
const { t } = useTranslation('fields');
|
|
29
29
|
const { openModal, toggleModal } = useModal();
|
|
30
30
|
const [renderModal, setRenderModal] = useState(false);
|
|
31
31
|
const [renderPopup, setRenderPopup] = useState(false);
|
|
@@ -67,11 +67,11 @@ export const LinkElement = ({ attributes, children, element, editorRef, fieldPro
|
|
|
67
67
|
newTab: element.newTab,
|
|
68
68
|
fields: deepCopyObject(element.fields),
|
|
69
69
|
};
|
|
70
|
-
const state = await buildStateFromSchema({ fieldSchema, data, user, operation: 'update', locale,
|
|
70
|
+
const state = await buildStateFromSchema({ fieldSchema, data, user, operation: 'update', locale, t });
|
|
71
71
|
setInitialState(state);
|
|
72
72
|
};
|
|
73
73
|
awaitInitialState();
|
|
74
|
-
}, [renderModal, element, fieldSchema, user, locale,
|
|
74
|
+
}, [renderModal, element, fieldSchema, user, locale, t]);
|
|
75
75
|
return (React.createElement("span", { className: baseClass, ...attributes },
|
|
76
76
|
React.createElement("span", { style: { userSelect: 'none' }, contentEditable: false },
|
|
77
77
|
renderModal && (React.createElement(EditModal, { modalSlug: modalSlug, fieldSchema: fieldSchema, close: () => {
|
package/dist/admin/components/forms/field-types/RichText/elements/relationship/Button/index.js
CHANGED
|
@@ -42,7 +42,7 @@ const RelationshipButton = ({ path }) => {
|
|
|
42
42
|
setLoading(true);
|
|
43
43
|
const res = await requests.get(`${serverURL}${api}/${relationTo}/${value}?depth=0`, {
|
|
44
44
|
headers: {
|
|
45
|
-
'
|
|
45
|
+
'Accept-Language': i18n.language,
|
|
46
46
|
},
|
|
47
47
|
});
|
|
48
48
|
const json = await res.json();
|
package/dist/admin/components/forms/field-types/RichText/elements/upload/Element/EditModal/index.js
CHANGED
|
@@ -31,11 +31,11 @@ export const EditModal = ({ slug, closeModal, relatedCollectionConfig, fieldSche
|
|
|
31
31
|
}, [closeModal, editor, element]);
|
|
32
32
|
useEffect(() => {
|
|
33
33
|
const awaitInitialState = async () => {
|
|
34
|
-
const state = await buildStateFromSchema({ fieldSchema, data: { ...(element === null || element === void 0 ? void 0 : element.fields) || {} }, user, operation: 'update', locale,
|
|
34
|
+
const state = await buildStateFromSchema({ fieldSchema, data: { ...(element === null || element === void 0 ? void 0 : element.fields) || {} }, user, operation: 'update', locale, t });
|
|
35
35
|
setInitialState(state);
|
|
36
36
|
};
|
|
37
37
|
awaitInitialState();
|
|
38
|
-
}, [fieldSchema, element.fields, user, locale,
|
|
38
|
+
}, [fieldSchema, element.fields, user, locale, t]);
|
|
39
39
|
return (React.createElement(Modal, { slug: slug, className: baseClass },
|
|
40
40
|
React.createElement(MinimalTemplate, { width: "wide" },
|
|
41
41
|
React.createElement("header", { className: `${baseClass}__header` },
|
|
@@ -35,7 +35,7 @@ const UploadInput = (props) => {
|
|
|
35
35
|
const response = await fetch(`${serverURL}${api}/${relationTo}/${value}`, {
|
|
36
36
|
credentials: 'include',
|
|
37
37
|
headers: {
|
|
38
|
-
'
|
|
38
|
+
'Accept-Language': i18n.language,
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
if (response.ok) {
|
|
@@ -15,7 +15,7 @@ const useField = (options) => {
|
|
|
15
15
|
const operation = useOperation();
|
|
16
16
|
const field = useFormFields(([fields]) => fields[path]);
|
|
17
17
|
const dispatchField = useFormFields(([_, dispatch]) => dispatch);
|
|
18
|
-
const {
|
|
18
|
+
const { t } = useTranslation();
|
|
19
19
|
const { getData, getSiblingData, setModified } = useForm();
|
|
20
20
|
const value = field === null || field === void 0 ? void 0 : field.value;
|
|
21
21
|
const initialValue = field === null || field === void 0 ? void 0 : field.initialValue;
|
|
@@ -77,7 +77,7 @@ const useField = (options) => {
|
|
|
77
77
|
data: getData(),
|
|
78
78
|
siblingData: getSiblingData(path),
|
|
79
79
|
operation,
|
|
80
|
-
|
|
80
|
+
t,
|
|
81
81
|
};
|
|
82
82
|
const validationResult = typeof validate === 'function' ? await validate(value, validateOptions) : true;
|
|
83
83
|
if (typeof validationResult === 'string') {
|
|
@@ -27,7 +27,11 @@ export const AuthProvider = ({ children }) => {
|
|
|
27
27
|
const remainingTime = (exp || 0) - now;
|
|
28
28
|
if (exp && remainingTime < 120) {
|
|
29
29
|
setTimeout(async () => {
|
|
30
|
-
const request = await requests.post(`${serverURL}${api}/${userSlug}/refresh-token
|
|
30
|
+
const request = await requests.post(`${serverURL}${api}/${userSlug}/refresh-token`, {
|
|
31
|
+
headers: {
|
|
32
|
+
'Accept-Language': i18n.language,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
31
35
|
if (request.status === 200) {
|
|
32
36
|
const json = await request.json();
|
|
33
37
|
setUser(json.user);
|
|
@@ -38,7 +42,7 @@ export const AuthProvider = ({ children }) => {
|
|
|
38
42
|
}
|
|
39
43
|
}, 1000);
|
|
40
44
|
}
|
|
41
|
-
}, [
|
|
45
|
+
}, [exp, serverURL, api, userSlug, push, admin, logoutInactivityRoute, i18n]);
|
|
42
46
|
const setToken = useCallback((token) => {
|
|
43
47
|
const decoded = jwtDecode(token);
|
|
44
48
|
setUser(decoded);
|
|
@@ -54,7 +58,7 @@ export const AuthProvider = ({ children }) => {
|
|
|
54
58
|
const fetchMe = async () => {
|
|
55
59
|
const request = await requests.get(`${serverURL}${api}/${userSlug}/me`, {
|
|
56
60
|
headers: {
|
|
57
|
-
'
|
|
61
|
+
'Accept-Language': i18n.language,
|
|
58
62
|
},
|
|
59
63
|
});
|
|
60
64
|
if (request.status === 200) {
|
|
@@ -81,7 +85,7 @@ export const AuthProvider = ({ children }) => {
|
|
|
81
85
|
async function getPermissions() {
|
|
82
86
|
const request = await requests.get(`${serverURL}${api}/access`, {
|
|
83
87
|
headers: {
|
|
84
|
-
'
|
|
88
|
+
'Accept-Language': i18n.language,
|
|
85
89
|
},
|
|
86
90
|
});
|
|
87
91
|
if (request.status === 200) {
|
|
@@ -122,7 +126,7 @@ export const AuthProvider = ({ children }) => {
|
|
|
122
126
|
if (forceLogOut)
|
|
123
127
|
clearTimeout(forceLogOut);
|
|
124
128
|
};
|
|
125
|
-
}, [exp, push, closeAllModals, admin]);
|
|
129
|
+
}, [exp, push, closeAllModals, admin, i18n, logoutInactivityRoute]);
|
|
126
130
|
return (React.createElement(Context.Provider, { value: {
|
|
127
131
|
user,
|
|
128
132
|
logOut,
|