mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2024-11-22 14:23:57 +00:00
BETTERZON-141: Fixing service class
- Because Patrick was stupid
This commit is contained in:
parent
68e9d75e2d
commit
f2adb1e375
|
@ -11,7 +11,7 @@ import {ContactPerson} from '../models/contactperson';
|
||||||
import {Category} from '../models/category';
|
import {Category} from '../models/category';
|
||||||
import {Manufacturer} from '../models/manufacturer';
|
import {Manufacturer} from '../models/manufacturer';
|
||||||
import {CrawlingStatus} from '../models/crawlingstatus';
|
import {CrawlingStatus} from '../models/crawlingstatus';
|
||||||
import {log} from "util";
|
import {log} from 'util';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -206,10 +206,10 @@ export class ApiService {
|
||||||
*/
|
*/
|
||||||
deactivateSingleVendorListing(vendorId: number, productId: number): Observable<any> {
|
deactivateSingleVendorListing(vendorId: number, productId: number): Observable<any> {
|
||||||
try {
|
try {
|
||||||
return this.http.put((this.apiUrl + '/vendors/manage/deactivatelisting'), JSON.stringify({
|
return this.http.put((this.apiUrl + '/vendors/manage/deactivatelisting'), {
|
||||||
vendor_id: vendorId,
|
vendor_id: vendorId,
|
||||||
product_id: productId
|
product_id: productId
|
||||||
}));
|
});
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ export class ApiService {
|
||||||
*/
|
*/
|
||||||
deactivateVendor(vendorId: number): Observable<any> {
|
deactivateVendor(vendorId: number): Observable<any> {
|
||||||
try {
|
try {
|
||||||
return this.http.put((this.apiUrl + '/vendors/manage/shop/deactivate/' + vendorId), JSON.stringify({}));
|
return this.http.put((this.apiUrl + '/vendors/manage/shop/deactivate/' + vendorId), {});
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ export class ApiService {
|
||||||
*/
|
*/
|
||||||
activateVendor(vendorId: number): Observable<any> {
|
activateVendor(vendorId: number): Observable<any> {
|
||||||
try {
|
try {
|
||||||
return this.http.put((this.apiUrl + '/vendors/manage/shop/activate/' + vendorId), JSON.stringify({}));
|
return this.http.put((this.apiUrl + '/vendors/manage/shop/activate/' + vendorId), {});
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
||||||
}
|
}
|
||||||
|
@ -269,10 +269,10 @@ export class ApiService {
|
||||||
*/
|
*/
|
||||||
createPriceAlarms(productId: number, definedPrice: number): Observable<any> {
|
createPriceAlarms(productId: number, definedPrice: number): Observable<any> {
|
||||||
try {
|
try {
|
||||||
return this.http.post((this.apiUrl + '/pricealarms'), JSON.stringify({
|
return this.http.post((this.apiUrl + '/pricealarms'), {
|
||||||
product_id: productId,
|
product_id: productId,
|
||||||
defined_price: definedPrice
|
defined_price: definedPrice
|
||||||
}));
|
});
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
||||||
}
|
}
|
||||||
|
@ -286,10 +286,10 @@ export class ApiService {
|
||||||
*/
|
*/
|
||||||
updatePriceAlarms(alarmId: number, definedPrice: number): Observable<any> {
|
updatePriceAlarms(alarmId: number, definedPrice: number): Observable<any> {
|
||||||
try {
|
try {
|
||||||
return this.http.put((this.apiUrl + '/pricealarms'), JSON.stringify({
|
return this.http.put((this.apiUrl + '/pricealarms'), {
|
||||||
alarm_id: alarmId,
|
alarm_id: alarmId,
|
||||||
defined_price: definedPrice
|
defined_price: definedPrice
|
||||||
}));
|
});
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
||||||
}
|
}
|
||||||
|
@ -312,11 +312,11 @@ export class ApiService {
|
||||||
*/
|
*/
|
||||||
registerUser(username: string, password: string, email: string): Observable<any> {
|
registerUser(username: string, password: string, email: string): Observable<any> {
|
||||||
try {
|
try {
|
||||||
return this.http.post((this.apiUrl + '/users/register'), JSON.stringify({
|
return this.http.post((this.apiUrl + '/users/register'), {
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
email
|
email
|
||||||
}));
|
});
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
||||||
}
|
}
|
||||||
|
@ -330,10 +330,10 @@ export class ApiService {
|
||||||
*/
|
*/
|
||||||
loginUser(username: string, password: string): Observable<any> {
|
loginUser(username: string, password: string): Observable<any> {
|
||||||
try {
|
try {
|
||||||
return this.http.post((this.apiUrl + '/users/login'), JSON.stringify({
|
return this.http.post((this.apiUrl + '/users/login'), {
|
||||||
username,
|
username,
|
||||||
password
|
password
|
||||||
}));
|
});
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
||||||
}
|
}
|
||||||
|
@ -366,9 +366,9 @@ export class ApiService {
|
||||||
*/
|
*/
|
||||||
addFavoriteShop(vendorId: number): Observable<any> {
|
addFavoriteShop(vendorId: number): Observable<any> {
|
||||||
try {
|
try {
|
||||||
return this.http.post((this.apiUrl + '/favoriteshops'), JSON.stringify({
|
return this.http.post((this.apiUrl + '/favoriteshops'), {
|
||||||
vendor_id: vendorId
|
vendor_id: vendorId
|
||||||
}));
|
});
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
||||||
}
|
}
|
||||||
|
@ -445,14 +445,14 @@ export class ApiService {
|
||||||
*/
|
*/
|
||||||
addContactPerson(vendorId: number, firstName: string, lastName: string, gender: string, email: string, phone: string): Observable<any> {
|
addContactPerson(vendorId: number, firstName: string, lastName: string, gender: string, email: string, phone: string): Observable<any> {
|
||||||
try {
|
try {
|
||||||
return this.http.post((this.apiUrl + '/contactpersons'), JSON.stringify({
|
return this.http.post((this.apiUrl + '/contactpersons'), {
|
||||||
vendor_id: vendorId,
|
vendor_id: vendorId,
|
||||||
first_name: firstName,
|
first_name: firstName,
|
||||||
last_name: lastName,
|
last_name: lastName,
|
||||||
gender,
|
gender,
|
||||||
email,
|
email,
|
||||||
phone
|
phone
|
||||||
}));
|
});
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
||||||
}
|
}
|
||||||
|
@ -471,14 +471,14 @@ export class ApiService {
|
||||||
*/
|
*/
|
||||||
updateContactPerson(contactId: number, vendorId: number, firstName: string, lastName: string, gender: string, email: string, phone: string): Observable<any> {
|
updateContactPerson(contactId: number, vendorId: number, firstName: string, lastName: string, gender: string, email: string, phone: string): Observable<any> {
|
||||||
try {
|
try {
|
||||||
return this.http.put((this.apiUrl + '/contactpersons/' + contactId), JSON.stringify({
|
return this.http.put((this.apiUrl + '/contactpersons/' + contactId), {
|
||||||
vendor_id: vendorId,
|
vendor_id: vendorId,
|
||||||
first_name: firstName,
|
first_name: firstName,
|
||||||
last_name: lastName,
|
last_name: lastName,
|
||||||
gender,
|
gender,
|
||||||
email,
|
email,
|
||||||
phone
|
phone
|
||||||
}));
|
});
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user