Skip to content

Commit

Permalink
port change
Browse files Browse the repository at this point in the history
  • Loading branch information
ankushchk committed Jul 24, 2024
1 parent d02eadf commit 467c063
Show file tree
Hide file tree
Showing 8 changed files with 29,324 additions and 48 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/CourseDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const CourseDetail: React.FC = () => {

useEffect(() => {
async function getCourses() {
const res = await axios.get("http://localhost:3000/admin/courses/", {
const res = await axios.get("http://localhost:3001/admin/courses/", {
headers: {
Authorization: "Bearer " + localStorage.getItem("token"),
},
Expand Down Expand Up @@ -140,7 +140,7 @@ function UpdateCourseCard({
async function handleUpdate(e: React.FormEvent) {
e.preventDefault();
await axios.put(
"http://localhost:3000/admin/courses/" + course._id,
"http://localhost:3001/admin/courses/" + course._id,
{
title: title,
description: description,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/CreateCourse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const CreateCourse: React.FC = () => {
const handleAddCourse = async () => {
// e.preventDefault();
await axios.post(
"http://localhost:3000/admin/courses",
"http://localhost:3001/admin/courses",
{
title: title,
description: description,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Landing: React.FC = () => {
const token = localStorage.getItem("token");
if (token && token !== "null") {
try {
const res = await axios.get("http://localhost:3000/admin/me", {
const res = await axios.get("http://localhost:3001/admin/me", {
headers: {
Authorization: `Bearer ${token}`,
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Login: React.FC = () => {
const handleLogin = async (e: React.FormEvent) => {
e.preventDefault();
try {
const res = await axios.post("http://localhost:3000/admin/login", {
const res = await axios.post("http://localhost:3001/admin/login", {
username: email,
password: password,
});
Expand Down
17 changes: 8 additions & 9 deletions frontend/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Navbar: React.FC = () => {
async function getAdminRouteMe() {
const token = localStorage.getItem("token");
if (token && token !== "null") {
const res = await axios.get("http://localhost:3000/admin/me", {
const res = await axios.get("http://localhost:3001/admin/me", {
headers: {
Authorization: "Bearer " + token,
},
Expand All @@ -28,7 +28,10 @@ const Navbar: React.FC = () => {
if (data.username) {
setAuthStatus(true);
setUser({ username: data.username });
localStorage.setItem("user", JSON.stringify({ username: data.username }));
localStorage.setItem(
"user",
JSON.stringify({ username: data.username })
);
}
}
}
Expand All @@ -46,13 +49,13 @@ const Navbar: React.FC = () => {
}, []);

// Handle user logout
const handleLogout = () => {
const handleLogout = () => {
localStorage.setItem("token", "null");
localStorage.removeItem("user");
setAuthStatus(false);
setUser(null);
navigate(0);
}
};

return (
<Box sx={{ flexGrow: 1 }}>
Expand All @@ -75,11 +78,7 @@ const Navbar: React.FC = () => {
>
Welcome! <b>{user?.username}</b>
</Typography>
<Button
color="error"
variant="contained"
onClick={handleLogout}
>
<Button color="error" variant="contained" onClick={handleLogout}>
Logout
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Register: React.FC = () => {
e.preventDefault();

try {
const res = await axios.post("http://localhost:3000/admin/signup", {
const res = await axios.post("http://localhost:3001/admin/signup", {
username: email,
password: password,
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ShowCourses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const ShowCourses: React.FC = () => {
const [courses, setCourses] = useRecoilState(coursesState);

async function getCourses() {
const res = await axios.get("http://localhost:3000/admin/courses/", {
const res = await axios.get("http://localhost:3001/admin/courses/", {
headers: {
Authorization: "Bearer " + localStorage.getItem("token"),
},
Expand Down
29,341 changes: 29,309 additions & 32 deletions server/public/assets/index-Q6Fav7vv.js

Large diffs are not rendered by default.

0 comments on commit 467c063

Please sign in to comment.