Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bunch of issues. #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin-client/src/components/AddCourse.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function AddCourse() {
const [image, setImage] = useState("");
const [price, setPrice] = useState(0)

return <div style={{display: "flex", justifyContent: "center", minHeight: "80vh", justifyContent: "center", flexDirection: "column"}}>
return <div style={{display: "flex", justifyContent: "center", minHeight: "80vh", flexDirection: "column"}}>
<div style={{display: "flex", justifyContent: "center"}}>
<Card varint={"outlined"} style={{width: 400, padding: 20, marginTop: 30, height: "100%"}}>
<TextField
Expand Down
1 change: 1 addition & 0 deletions admin-client/src/components/Signin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import TextField from "@mui/material/TextField";
import {Card, Typography} from "@mui/material";
import {useState} from "react";
import axios from "axios";
import { BASE_URL } from "../config.js";
import {useNavigate} from "react-router-dom";
import {useSetRecoilState} from "recoil";
import {userState} from "../store/atoms/user.js";
Expand Down
6 changes: 4 additions & 2 deletions node_modules/.yarn-integrity

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/routes/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ router.post('/signup', (req, res) => {
});

router.post('/login', async (req, res) => {
const { username, password } = req.headers;
const { username, password } = req.body;
const admin = await Admin.findOne({ username, password });
if (admin) {
const token = jwt.sign({ username, role: 'admin' }, SECRET, { expiresIn: '1h' });
Expand Down
2 changes: 1 addition & 1 deletion server/routes/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const router = express.Router();
});

router.post('/login', async (req, res) => {
const { username, password } = req.headers;
const { username, password } = req.body;
const user = await User.findOne({ username, password });
if (user) {
const token = jwt.sign({ username, role: 'user' }, SECRET, { expiresIn: '1h' });
Expand Down