fix: make jira fallback less greedy and more specific

This commit is contained in:
Johannes Millan 2025-09-18 18:35:27 +02:00
parent 5a555c1fc2
commit bc21f0874f

View file

@ -33,7 +33,6 @@ import {
mapTo,
shareReplay,
take,
tap,
timeoutWith,
} from 'rxjs/operators';
import { JiraIssue, JiraIssueReduced } from './jira-issue.model';
@ -153,19 +152,20 @@ export class JiraApiService {
// ),
catchError((err) => {
const code = err?.error?.statusCode ?? err?.status ?? err?.error?.status;
if (code === 401 || code === 403) return throwError(() => err);
// Fallback for Server/DC: /search?jql=...
return this._sendRequest$({
jiraReqCfg: {
pathname: 'search',
followAllRedirects: true,
query: { jql: searchTermJQL },
transform: mapToSearchResultsForJQL,
},
cfg,
});
if (code === 404) {
// Fallback for Server/DC: /search?jql=...
return this._sendRequest$({
jiraReqCfg: {
pathname: 'search',
followAllRedirects: true,
query: { jql: searchTermJQL },
transform: mapToSearchResultsForJQL,
},
cfg,
});
}
return throwError(() => err);
}),
tap((v) => IssueLog.log('AAAAA', v)),
);
}