Skip to content

Commit eaadf1d

Browse files
committed
http access
1 parent 2f18a97 commit eaadf1d

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

frontend/src/components/NewStudent.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function NewStudent() {
99

1010
const handleSubmit = (e) => {
1111
e.preventDefault();
12-
fetch('http://spring-react-backend-latest.onrender.com/student/add', {
12+
fetch('https://spring-react-backend-latest.onrender.com/student/add', {
1313
method: 'POST',
1414
headers: { 'Content-Type': 'application/json' },
1515
body: JSON.stringify(student)

frontend/src/components/Students.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ function Students() {
66
const navigate = useNavigate();
77

88
useEffect(() => {
9-
fetch('http://spring-react-backend-latest.onrender.com/student')
9+
fetch('https://spring-react-backend-latest.onrender.com/student')
1010
.then(res => res.json())
1111
.then(data => setStudents(data))
1212
.catch(err => console.error('Error fetching students:', err));
1313
}, []);
1414

1515
const deleteStudent = (id) => {
1616
if (!window.confirm('Are you sure you want to delete this student?')) return;
17-
fetch(`http://spring-react-backend-latest.onrender.com/student/delete/${id}`, { method: 'DELETE' })
17+
fetch(`https://spring-react-backend-latest.onrender.com/student/delete/${id}`, { method: 'DELETE' })
1818
.then(() => setStudents(prev => prev.filter(s => s.id !== id)))
1919
.catch(err => console.error('Delete failed:', err));
2020
};

frontend/src/components/UpdateStudent.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function UpdateStudent() {
77
const navigate = useNavigate();
88

99
useEffect(() => {
10-
fetch(`http://spring-react-backend-latest.onrender.com/student/${id}`)
10+
fetch(`https://spring-react-backend-latest.onrender.com/student/${id}`)
1111
.then(res => res.json())
1212
.then(data => {
1313
console.log("student", data);
@@ -20,7 +20,7 @@ function UpdateStudent() {
2020

2121
const handleSubmit = (e) => {
2222
e.preventDefault();
23-
fetch(`http://spring-react-backend-latest.onrender.com/student/update/${id}?firstName=${encodeURIComponent(student.firstName)}&lastName=${encodeURIComponent(student.lastName)}&email=${encodeURIComponent(student.email)}&dob=${encodeURIComponent(student.dob)}`, {
23+
fetch(`https://spring-react-backend-latest.onrender.com/student/update/${id}?firstName=${encodeURIComponent(student.firstName)}&lastName=${encodeURIComponent(student.lastName)}&email=${encodeURIComponent(student.email)}&dob=${encodeURIComponent(student.dob)}`, {
2424
method: 'PUT',
2525
headers: { 'Content-Type': 'application/json' },
2626
body: JSON.stringify(student) // can also be '{}' or null if your backend ignores it

0 commit comments

Comments
 (0)