diff --git a/components/Party/index.tsx b/components/Party/index.tsx index aba5eb09..23c75e78 100644 --- a/components/Party/index.tsx +++ b/components/Party/index.tsx @@ -147,7 +147,7 @@ const Party = (props: Props) => { } // Methods: Storing party data - const storeParty = function (team: Party) { + const storeParty = function (team: any) { // Store the important party and state-keeping values in global state appState.party.name = team.name appState.party.description = team.description @@ -170,6 +170,9 @@ const Party = (props: Props) => { appState.party.detailsVisible = false + // Store the edit key in local storage + if (team.edit_key) storeEditKey(team.id, team.edit_key) + // Populate state storeCharacters(team.characters) storeWeapons(team.weapons) @@ -191,6 +194,10 @@ const Party = (props: Props) => { return team } + const storeEditKey = (id: string, key: string) => { + ls(id, key) + } + const storeCharacters = (list: Array) => { list.forEach((object: GridCharacter) => { if (object.position != null) diff --git a/package-lock.json b/package-lock.json index 19dcccba..c5ab4514 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ "i18next": "^21.6.13", "i18next-browser-languagedetector": "^6.1.3", "i18next-http-backend": "^1.3.2", + "local-storage": "^2.0.0", "lodash.clonedeep": "^4.5.0", "lodash.debounce": "^4.0.8", "meyer-reset-scss": "^2.0.4", @@ -5655,6 +5656,11 @@ "json5": "lib/cli.js" } }, + "node_modules/local-storage": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/local-storage/-/local-storage-2.0.0.tgz", + "integrity": "sha512-/0sRoeijw7yr/igbVVygDuq6dlYCmtsuTmmpnweVlVtl/s10pf5BCq8LWBxW/AMyFJ3MhMUuggMZiYlx6qr9tw==" + }, "node_modules/lodash.clonedeep": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", @@ -11398,6 +11404,11 @@ } } }, + "local-storage": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/local-storage/-/local-storage-2.0.0.tgz", + "integrity": "sha512-/0sRoeijw7yr/igbVVygDuq6dlYCmtsuTmmpnweVlVtl/s10pf5BCq8LWBxW/AMyFJ3MhMUuggMZiYlx6qr9tw==" + }, "lodash.clonedeep": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", diff --git a/package.json b/package.json index d3911bc4..f0347c8b 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "i18next": "^21.6.13", "i18next-browser-languagedetector": "^6.1.3", "i18next-http-backend": "^1.3.2", + "local-storage": "^2.0.0", "lodash.clonedeep": "^4.5.0", "lodash.debounce": "^4.0.8", "meyer-reset-scss": "^2.0.4",