Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
felipesud committed Jul 15, 2023
1 parent f87101c commit fe293dd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
17 changes: 17 additions & 0 deletions frontend/src/app/adapters/temple.adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Injectable } from '@angular/core';
import { Temple } from '../models/temple.model';

@Injectable({
providedIn: 'root'
})
export class TempleAdapter {
adapt(response: any): Temple {
return {
id: response._id,
name: response.name,
address: response.address,
telephone: response.telephone,
photoUrl: response.photoUrl
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ export class TempleDetailsComponent implements OnInit {

updateTempleDetails(id: string, templeData: Temple) {
this.templeService.updateTemple(id, templeData).subscribe(
(response) => {
// Lógica para lidar com a resposta após a atualização do templo
(updatedTemple) => {

console.log("Temple updated successfully:", updatedTemple);
},
(error) => {
console.log(error);
console.log("Error updating temple:", error);
}
);
}


deleteTemple(id: string) {
this.templeService.deleteTemple(id).subscribe(
(response) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,11 @@ export class TempleFormComponent implements OnInit {
const templeData: Temple = this.templeForm.value;
this.templeService.createTemple(templeData).subscribe(
(response) => {
this.getTempleList();
console.log("Temple created successfully:", response);
},
(error) => {
// Lógica para lidar com erros
console.log("Error creating temple:", error);
}
);
}

getTempleList(): void {
// Implemente a lógica para obter a lista de templos atualizada após a criação de um novo templo
}
}

0 comments on commit fe293dd

Please sign in to comment.