change harcoded URL to .env/secrets
This commit is contained in:
parent
8e1af2e846
commit
98320b6fdd
3 changed files with 7 additions and 5 deletions
2
.env
2
.env
|
|
@ -1,2 +1,2 @@
|
||||||
#VITE_AUTH_URL="http://localhost:8080"
|
|
||||||
VITE_AUTH_URL="https://byte-camp-auth-service.fly.dev"
|
VITE_AUTH_URL="https://byte-camp-auth-service.fly.dev"
|
||||||
|
VITE_ASSIGNMENT_URL="https://assignment-service.internal"
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
VITE_AUTH_URL="http://localhost:8080"
|
VITE_AUTH_URL="http://localhost:8080"
|
||||||
#VITE_AUTH_URL="https://byte-camp-auth-service.fly.dev"
|
VITE_ASSIGNMENT_URL="http://localhost:8082"
|
||||||
|
|
@ -15,6 +15,8 @@ const AssignmentPage = () => {
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
const [editingIndex, setEditingIndex] = useState(null);
|
const [editingIndex, setEditingIndex] = useState(null);
|
||||||
|
|
||||||
|
const VITE_ASSIGNMENT_URL = import.meta.env.VITE_ASSIGNMENT_URL;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.title = "Assignment";
|
document.title = "Assignment";
|
||||||
fetchAssignments();
|
fetchAssignments();
|
||||||
|
|
@ -22,7 +24,7 @@ const AssignmentPage = () => {
|
||||||
|
|
||||||
const fetchAssignments = async () => {
|
const fetchAssignments = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await fetch("http://localhost:8082/instructor/list/9", {
|
const res = await fetch(`${VITE_ASSIGNMENT_URL}/instructor/list/9`, {
|
||||||
// credentials: "include",
|
// credentials: "include",
|
||||||
});
|
});
|
||||||
if (!res.ok) throw new Error("Failed to fetch");
|
if (!res.ok) throw new Error("Failed to fetch");
|
||||||
|
|
@ -80,7 +82,7 @@ const AssignmentPage = () => {
|
||||||
formData.append("file", file, file.name);
|
formData.append("file", file, file.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch("http://localhost:8082/instructor/create", {
|
fetch(`${VITE_ASSIGNMENT_URL}/instructor/create`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue