30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import {Injectable} from '@angular/core';
|
|
import {HttpClient, HttpResponse} from "@angular/common/http";
|
|
import {Observable} from "rxjs";
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class JtrService {
|
|
private url: string = import.meta.env.JTR_API_URL;
|
|
|
|
constructor(private http: HttpClient) {
|
|
}
|
|
|
|
public beautify(source: string): Observable<HttpResponse<any>> {
|
|
return this.http.post(`${this.url}/api/transform/beautify`, {Source: source}, {observe: "response"});
|
|
}
|
|
|
|
public uglify(source: string): Observable<HttpResponse<any>> {
|
|
return this.http.post(`${this.url}/api/transform/uglify`, {Source: source}, {observe: "response"});
|
|
}
|
|
|
|
public json2csharp(source: string): Observable<HttpResponse<any>> {
|
|
return this.http.post(`${this.url}/api/transform/json2csharp`, {Source: source}, {observe: "response"});
|
|
}
|
|
|
|
public jsonPath(source: string, path: string): Observable<HttpResponse<any>> {
|
|
return this.http.post(`${this.url}/api/transform/jsonpath`, {source: source, path: path}, {observe: "response"});
|
|
}
|
|
}
|