Skip to content

Commit

Permalink
alterações para deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreLJr committed Feb 11, 2025
1 parent 1197fb3 commit e6420d9
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.example.backend.repository.PetRepository;
import com.example.backend.service.AgendamentoService;

@CrossOrigin(origins = {"https://two024-2-t03-petshopguara-tlv0.onrender.com", "http://127.0.0.1:5501"})
@RestController
@RequestMapping("/agendamentos")
public class AgendamentoController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@CrossOrigin(origins = {"https://two024-2-t03-petshopguara-tlv0.onrender.com", "http://127.0.0.1:5501"})
@RestController
@RequestMapping("/donos")
public class ClienteController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@CrossOrigin(origins = {"https://two024-2-t03-petshopguara-tlv0.onrender.com", "http://127.0.0.1:5501"})
@RestController
@RequestMapping("/api/dono")
public class DonoController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import java.util.List;
import java.util.Map;

@CrossOrigin(origins = {"https://two024-2-t03-petshopguara-tlv0.onrender.com", "http://127.0.0.1:5501"})
@RestController
@RequestMapping("/api/funcionarios")
public class FuncionarioController {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.example.backend.controller;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin(origins = {"https://two024-2-t03-petshopguara-tlv0.onrender.com", "http://127.0.0.1:5501"})
@RequestMapping("/")
public class HomeController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin(origins = {"https://two024-2-t03-petshopguara-tlv0.onrender.com", "http://127.0.0.1:5501"})
@RestController
@RequestMapping("/pets")
public class PetController {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REACT_APP_API_URL = "http://localhost:8080"
REACT_APP_API_URL = "https://two024-2-t03-petshopguara-esum.onrender.com"
2 changes: 1 addition & 1 deletion frontend/src/pages/Cadastro/cadastrarCliente.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const CadastrarDono = () => {
const handleSubmit = async (event) => {
event.preventDefault();
try {
const response = await axios.post('http://localhost:8080/donos/cadastrar', {
const response = await axios.post('https://two024-2-t03-petshopguara-esum.onrender.com/donos/cadastrar', {
email: email, nome: nome, endereco: endereco, telefone: telefone, senha: senha
});
alert("Dono cadastrado com sucesso!");
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Pets/Agendamentos.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Agendamentos = () => {
useEffect(() => {
const fetchAgendamentos = async () => {
try {
const response = await fetch("http://localhost:8080/agendamentos/consultar");
const response = await fetch("https://two024-2-t03-petshopguara-esum.onrender.com/agendamentos/consultar");
if (!response.ok) {
throw new Error("Erro ao buscar agendamentos");
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Pets/CadastrarPet.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const CadastroPet = () => {
const handleSubmit = async (e) => {
e.preventDefault();
try {
await axios.post("http://localhost:8080/pets/cadastrar", formData);
await axios.post("https://two024-2-t03-petshopguara-esum.onrender.com/pets/cadastrar", formData);
alert("Pet cadastrado com sucesso!");
setFormData({
nome: "",
Expand Down
20 changes: 10 additions & 10 deletions frontend/src/services/APIService.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function cadastrarPet(pet) {

export async function consultarPet(petId) {
try {
const response = await axios.get(`http://localhost:8080/pets/consultar/${petId}`);
const response = await axios.get(`https://two024-2-t03-petshopguara-esum.onrender.com/pets/consultar/${petId}`);
return response.data;
} catch (error) {
console.error("Erro ao consultar pet:", error);
Expand All @@ -28,15 +28,15 @@ export async function consultarPet(petId) {
}

export const consultarDadosPets = async (clienteId) => {
const response = await fetch(`http://localhost:8080/pets/consultar/${clienteId}`);
const response = await fetch(`https://two024-2-t03-petshopguara-esum.onrender.com/pets/consultar/${clienteId}`);
if (!response.ok) {
throw new Error("Erro ao buscar pets");
}
return await response.json();
}

export const listarPets = async () => {
const response = await fetch(`http://localhost:8080/pets/consultar`);
const response = await fetch(`https://two024-2-t03-petshopguara-esum.onrender.com/pets/consultar`);
if (!response.ok) {
throw new Error("Erro ao buscar pets");
}
Expand All @@ -50,16 +50,16 @@ export const cadastrarCliente = async (cliente) => {

export async function realizarLogin(email, senha, perfil) {
try {
let uri = "http://localhost:8080/donos/login"
let uri = "https://two024-2-t03-petshopguara-esum.onrender.com/donos/login"
switch (perfil) {
case "Cliente":
uri = "http://localhost:8080/donos/login"
uri = "https://two024-2-t03-petshopguara-esum.onrender.com/donos/login"
break;
case "Dono":
uri = "http://localhost:8080/api/dono/login"
uri = "https://two024-2-t03-petshopguara-esum.onrender.com/api/dono/login"
break;
case "Funcionario":
uri = "http://localhost:8080/api/funcionarios/login"
uri = "https://two024-2-t03-petshopguara-esum.onrender.com/api/funcionarios/login"
break;
}
const response = await axios.get(`${uri}/${email}/${senha}`, {
Expand All @@ -77,7 +77,7 @@ export async function realizarLogin(email, senha, perfil) {
}

export const listarPerfil = async (clienteId) => {
const response = await fetch(`http://localhost:8080/donos/consultar/${clienteId}`);
const response = await fetch(`https://two024-2-t03-petshopguara-esum.onrender.com/donos/consultar/${clienteId}`);
if (!response.ok) {
throw new Error("Perfil não logado!");
}
Expand All @@ -88,7 +88,7 @@ export const listarPerfil = async (clienteId) => {
export async function agendarServico(dadosAgendamento) {
try {
const idCliente = localStorage.getItem('@User_id');
const response = await axios.post(`http://localhost:8080/agendamentos/agendar`, {
const response = await axios.post(`https://two024-2-t03-petshopguara-esum.onrender.com/agendamentos/agendar`, {
pet: dadosAgendamento.petSelecionado,
cliente: idCliente,
dataHora: dadosAgendamento.dataHora,
Expand All @@ -102,7 +102,7 @@ export async function agendarServico(dadosAgendamento) {
}

export async function visualizarAgendamento(){
const response = await fetch("http://localhost:8080/agendamentos/calendario");
const response = await fetch("https://two024-2-t03-petshopguara-esum.onrender.com/agendamentos/calendario");
if (!response.ok) {
throw new Error("Erro ao agendamento!");
}
Expand Down

0 comments on commit e6420d9

Please sign in to comment.