Skip to content

Commit

Permalink
chore(templates): remote auth token download flow
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Feb 15, 2024
1 parent f870683 commit c5b8640
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/app/Shared/Services/Api.service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -791,24 +791,12 @@ export class ApiService {
map(
(target) =>
`${this.login.authority}/api/v2.1/targets/${encodeURIComponent(
target?.connectUrl || '',
target!.connectUrl,
)}/templates/${encodeURIComponent(template.name)}/type/${encodeURIComponent(template.type)}`,
),
)
.subscribe((resource) => {
const body = new window.FormData();
body.append('resource', resource);
this.sendRequest('v2.1', 'auth/token', {
method: 'POST',
body,
})
.pipe(
concatMap((resp) => resp.json()),
map((response: AssetJwtResponse) => response.data.result.resourceUrl),
)
.subscribe((resourceUrl) => {
this.downloadFile(resourceUrl, `${template.name}.jfc`);
});
.subscribe((resourceUrl) => {
this.downloadFile(resourceUrl, `${template.name}.jfc`);
});
}

Expand Down

0 comments on commit c5b8640

Please sign in to comment.