Skip to content

Commit

Permalink
fix: add cluster param to getCrumb
Browse files Browse the repository at this point in the history
  • Loading branch information
harrisonliu5 committed Jul 6, 2020
1 parent 5d99c4e commit 8217691
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/stores/devops/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export default class Base extends BaseStore {
})
}

getCrumb = async () =>
getCrumb = async ({ cluster } = { cluster: '' }) =>
await this.catchRequestError(
'get',
`${this.getBaseUrlV2()}crumbissuer`,
`${this.getBaseUrlV2({ cluster })}crumbissuer`,
null,
null,
() => true
Expand All @@ -53,7 +53,13 @@ export default class Base extends BaseStore {
options = {}
}
if (globals.user.crumb === undefined) {
await this.getCrumb()
const match = url.match(/(clusters|klusters)\/([^/]*)\//)
if (match && match.length === 3) {
const cluster = match[2]
await this.getCrumb({ cluster })
} else {
await this.getCrumb()
}
}
if (globals.user.crumb) {
set(options, 'headers.Jenkins-Crumb', globals.user.crumb)
Expand Down
2 changes: 1 addition & 1 deletion src/stores/devops/pipelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ export default class PipelineStore extends BaseStore {
@action
async scanRepository({ project_id, name, cluster }) {
if (globals.user.crumb === undefined) {
await this.getCrumb()
await this.getCrumb({ cluster })
}
const options = {}
if (globals.user.crumb) {
Expand Down

0 comments on commit 8217691

Please sign in to comment.