-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
271 additions
and
186 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import axios from 'axios' | ||
|
||
const apiUrl = (endpoint) => `${import.meta.env.VITE_API_URL}${endpoint}` | ||
|
||
const getClasses = async () => { | ||
try { | ||
const response = await axios.get(apiUrl("/api/classes")) | ||
return response.data | ||
} catch (error) { | ||
console.error('Error fetching courses:', error) | ||
} | ||
} | ||
|
||
export { | ||
getClasses | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const apiUrl = (endpoint) => `${import.meta.env.VITE_API_URL}${endpoint}` | ||
|
||
const postContact = async (body) => { | ||
try { | ||
const response = await fetch(apiUrl("/api/contact"), { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify(body) | ||
}) | ||
|
||
return response | ||
} catch (error) { | ||
console.error('Contact endpoint post error:', error); | ||
} | ||
} | ||
|
||
export { | ||
postContact | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import axios from 'axios'; | ||
|
||
const apiUrl = (endpoint) => `${import.meta.env.VITE_API_URL}${endpoint}` | ||
|
||
const postUser = async (body) => { | ||
try { | ||
const response = await axios.post(apiUrl("/api/users"), body) | ||
return response | ||
} catch (error) { | ||
throw error | ||
} | ||
} | ||
|
||
const postLogin = async (body) => { | ||
try { | ||
const response = await fetch(apiUrl("/api/login"), { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify(body), | ||
}) | ||
|
||
return response | ||
} catch (error) { | ||
console.error('Login endpoint post error:', error); | ||
} | ||
} | ||
|
||
export { | ||
postUser, | ||
postLogin | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.