Bugfixes
This commit is contained in:
@@ -1,39 +1,38 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from '../../environments/environment';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { ImageType } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ImageService {
|
||||
|
||||
private apiBaseUrl = environment.apiBaseUrl;
|
||||
|
||||
constructor(private http: HttpClient) { }
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
uploadImage(imageBlob: Blob,type:'uploadPropertyPicture'|'uploadCompanyLogo'|'uploadProfile',id:string) {
|
||||
const uploadUrl = `${this.apiBaseUrl}/bizmatch/image/${type}/${id}`;
|
||||
uploadImage(imageBlob: Blob, type: 'uploadPropertyPicture' | 'uploadCompanyLogo' | 'uploadProfile', imagePath: string) {
|
||||
const uploadUrl = `${this.apiBaseUrl}/bizmatch/image/${type}/${imagePath}`;
|
||||
const formData = new FormData();
|
||||
formData.append('file', imageBlob, 'image.png');
|
||||
|
||||
return this.http.post(uploadUrl, formData,{
|
||||
|
||||
return this.http.post(uploadUrl, formData, {
|
||||
// headers: this.headers,
|
||||
//reportProgress: true,
|
||||
observe: 'events',
|
||||
observe: 'events',
|
||||
});
|
||||
}
|
||||
async deleteUserImage(userid:string,type:ImageType,name?:string){
|
||||
async deleteUserImage(userid: string, type: ImageType, name?: string) {
|
||||
return await lastValueFrom(this.http.delete<[]>(`${this.apiBaseUrl}/bizmatch/image/${type.delete}${userid}`));
|
||||
}
|
||||
async deleteListingImage(listingid:string,name?:string){
|
||||
async deleteListingImage(listingid: string, name?: string) {
|
||||
return await lastValueFrom(this.http.delete<[]>(`${this.apiBaseUrl}/bizmatch/image/propertyPicture/${listingid}/${name}`));
|
||||
}
|
||||
async getProfileImagesForUsers(userids:string[]){
|
||||
async getProfileImagesForUsers(userids: string[]) {
|
||||
return await lastValueFrom(this.http.get<[]>(`${this.apiBaseUrl}/bizmatch/image/profileImages/${userids.join(',')}`));
|
||||
}
|
||||
async getCompanyLogosForUsers(userids:string[]){
|
||||
async getCompanyLogosForUsers(userids: string[]) {
|
||||
return await lastValueFrom(this.http.get<[]>(`${this.apiBaseUrl}/bizmatch/image/companyLogos/${userids.join(',')}`));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user