Skip to content

Commit

Permalink
get/set user data on local core if no primary bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
chm-diederichs committed Mar 28, 2024
1 parent a699b4b commit 8c05f6a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,16 @@ module.exports = class Autobase extends ReadyResource {
// no guarantees where the user data is stored, just that its associated with the base
async setUserData (key, val) {
await this._presystem
await this._primaryBootstrap.setUserData(key, val)
const core = this._primaryBootstrap === null ? this.local : this._primaryBootstrap

await core.setUserData(key, val)
}

async getUserData (key) {
await this._presystem
return await this._primaryBootstrap.getUserData(key)
const core = this._primaryBootstrap === null ? this.local : this._primaryBootstrap

return await core.getUserData(key)
}

getNamespace (key, core) {
Expand Down

0 comments on commit 8c05f6a

Please sign in to comment.