Renamed get to getById, map improvement
This commit is contained in:
@ -14,7 +14,7 @@ export class BaseStorage<T extends { id: string }> {
|
||||
|
||||
async add(item: T, overwrite = false) {
|
||||
try {
|
||||
const existing = await this.get(item.id)
|
||||
const existing = await this.getById(item.id)
|
||||
if (existing && !overwrite) return
|
||||
|
||||
await this.dexie.table(this.tableName).put({ ...item })
|
||||
@ -39,7 +39,7 @@ export class BaseStorage<T extends { id: string }> {
|
||||
}
|
||||
}
|
||||
|
||||
async get(id: string): Promise<T | null> {
|
||||
async getById(id: string): Promise<T | null> {
|
||||
try {
|
||||
const item = await this.dexie.table(this.tableName).get(id)
|
||||
return item || null
|
||||
|
@ -31,7 +31,7 @@ export class CharacterTypeStorage extends BaseStorage<any> {
|
||||
}
|
||||
|
||||
async getSpriteId(characterTypeId: string) {
|
||||
const characterType = await this.get(characterTypeId)
|
||||
const characterType = await this.getById(characterTypeId)
|
||||
return characterType?.sprite
|
||||
}
|
||||
}
|
||||
@ -42,7 +42,7 @@ export class CharacterHairStorage extends BaseStorage<any> {
|
||||
}
|
||||
|
||||
async getSpriteId(characterTypeId: string) {
|
||||
const characterType = await this.get(characterTypeId)
|
||||
const characterType = await this.getById(characterTypeId)
|
||||
return characterType?.sprite
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user