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 committed Aug 30, 2023
1 parent d02f3c7 commit 13d66cc
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 13d66cc

Please sign in to comment.