Update to properly retreive stored spells
This commit is contained in:
parent
b3dbdd3280
commit
12596531a5
20
src/Place.ts
20
src/Place.ts
@ -8,13 +8,6 @@ export class Place extends LitElement {
|
|||||||
|
|
||||||
@property() getCurrentSpell: any = null;
|
@property() getCurrentSpell: any = null;
|
||||||
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
const storedSpells = JSON.parse(localStorage.getItem(this.location) ?? '[]');
|
|
||||||
this.spells = storedSpells;
|
|
||||||
}
|
|
||||||
|
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
location: {
|
location: {
|
||||||
@ -58,13 +51,16 @@ export class Place extends LitElement {
|
|||||||
];
|
];
|
||||||
|
|
||||||
override render() {
|
override render() {
|
||||||
|
const storedSpells = JSON.parse(localStorage.getItem(this.location) ?? '[]');
|
||||||
|
this.spells = storedSpells;
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div @click="${this.addSpell}">
|
<div @click="${this.addSpell}">
|
||||||
<h3>${this.location}</h3>
|
<h3>${this.location}</h3>
|
||||||
<div class="place-spells">
|
<div class="place-spells">
|
||||||
${this.spells.sort(spellSort).map(spell => spell ? html`<dd-spell .spellRemover="${(name: string) => this.removeSpell(name)}" name="${spell.name}" cost=${spell.cost} color="${spell.color}" category="${spell.category}" ?cantripMagic="${spell.cantripMagic ?? false}" ?reserveMagic="${spell.reserveMagic ?? false}" description="${spell.description}"></dd-spell>` : '')}
|
${this.spells.sort(spellSort).map(spell => spell ? html`<dd-spell .spellRemover="${(name: string) => this.removeSpell(name)}" name="${spell.name}" cost=${spell.cost} color="${spell.color}" category="${spell.category}" ?cantripMagic="${spell.cantripMagic ?? false}" ?reserveMagic="${spell.reserveMagic ?? false}" description="${spell.description}"></dd-spell>` : '')}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user