Remove old client and add new

This commit is contained in:
programmingPug
2025-01-04 14:41:08 -05:00
parent 42aa91f479
commit 0d7f77b1e3
56 changed files with 2158 additions and 1817 deletions

View File

@@ -0,0 +1,24 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { SoilData } from '../models/soil-data.model';
@Injectable({
providedIn: 'root'
})
export class SoilDataService {
private apiUrl = 'http://localhost:5284/api/'; // Replace with your actual API endpoint
constructor(private http: HttpClient) {}
getPlants(): Observable<SoilData[]> {
return this.http.get<SoilData[]>(this.apiUrl + 'devices');
}
// Update device nickname
updateNickname(name: string, nickname: string): Observable<any> {
const url = `${this.apiUrl}devices/${encodeURIComponent(name)}/nickname`;
return this.http.put(url, { nickname: nickname });
}
}