Store edit key in localStorage on create response
This commit is contained in:
parent
6b83f81eb6
commit
c0df78758b
3 changed files with 20 additions and 1 deletions
|
|
@ -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<GridCharacter>) => {
|
||||
list.forEach((object: GridCharacter) => {
|
||||
if (object.position != null)
|
||||
|
|
|
|||
11
package-lock.json
generated
11
package-lock.json
generated
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in a new issue