Skip to content

Commit

Permalink
add additional checks for identifying provider
Browse files Browse the repository at this point in the history
when using setResource().
Fixes creating a new resource entry.
  • Loading branch information
panaaj authored and tkurki committed Sep 4, 2023
1 parent 36bcfb5 commit 868d52a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/api/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,20 @@ export class ResourcesApi {
)
}
validate.resource(resType as SignalKResourceType, resId, 'PUT', data)
} else {
if (!resId) {
return Promise.reject(new Error(`No resource id provided!`))
}
}

let provider: string | undefined = undefined
if (providerId) {
provider = this.checkForProvider(resType, providerId)
} else {
provider = await this.getProviderForResourceId(resType, resId)
if (!provider) {
provider = this.checkForProvider(resType)
}
}
if (provider) {
return this.resProvider[resType]?.get(provider)?.setResource(resId, data)
Expand Down

0 comments on commit 868d52a

Please sign in to comment.