Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert error message in CVs' download #451

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/app/user/downloads/downloads.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ <h6 class="lead">

<div class="row">
<div class="col-sm-12">
<button (click)="downloadCVs()" class="btn btn-info">
<a href="{{ cvsDownloadUrl }}" target="_blank" class="btn btn-info">
<span class="glyphicon glyphicon-cloud-download"></span>
Download CVs
</button>
</a>
</div>
<div *ngIf="me && me.role === 'company'" class="col-sm-12">
<button (click)="downloadLinksCVs()" class="btn btn-info">
<span class="glyphicon glyphicon-link"></span>
Download Links' CVs
</button>
<a href="{{ linksCVsDownloadUrl }}" target="_blank" class="btn btn-info">
<span class="glyphicon glyphicon-link"></span>
Download Links' CVs
</a>
</div>

</div>
Expand Down
65 changes: 1 addition & 64 deletions src/app/user/downloads/downloads.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ import { environment } from '../../../environments/environment'
import { AuthService } from '../../auth/auth.service'
import { EventService } from '../../events/event.service'

import { catchError } from 'rxjs/operators';
import { Observable } from 'rxjs';


import { HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';

@Component({
selector: 'app-downloads',
templateUrl: './downloads.component.html',
Expand All @@ -32,8 +26,7 @@ export class DownloadsComponent implements OnInit {
private companyService: CompanyService,
private authService: AuthService,
private eventService: EventService,
private titleService: Title,
private http: HttpClient
private titleService: Title
) { }


Expand Down Expand Up @@ -70,60 +63,4 @@ export class DownloadsComponent implements OnInit {
})
}

downloadCVs() {
if (this.cvsDownloadUrl) {
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json'
}),
observe: 'response' as 'response'
};

this.http.get(this.cvsDownloadUrl, httpOptions)
.pipe(
catchError(err => {
console.error('Failed to download CVs:', err);
alert('Unable to dowload CVs at this time. When available the team will contact you.');
throw err; // Re-throw the error if needed for further handling
})
)
.subscribe({
next: response => {
// Success, open the download URL
window.open(this.cvsDownloadUrl, '_blank');
}
});
} else {
alert('CV download URL is not available.');
}
}

downloadLinksCVs() {
if (this.linksCVsDownloadUrl) {
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json'
}),
observe: 'response' as 'response'
};

this.http.get(this.linksCVsDownloadUrl, httpOptions)
.pipe(
catchError(err => {
console.error('Failed to download linked CVs:', err);
alert('Unable to dowload links CVs at this time. When available the team will contact you.');
throw err; // Re-throw the error if needed for further handling
})
)
.subscribe({
next: response => {
// Success, open the download URL
window.open(this.linksCVsDownloadUrl, '_blank');
}
});
} else {
alert('Links CV download URL is not available.');
}
}

}
Loading