Skip to content

Commit 183d1a8

Browse files
authored
Merge pull request #33 from buildingu/chore-fix-various-fixes
Patch for release 4.0.1-alpha
2 parents 9e854ef + 15cefe1 commit 183d1a8

File tree

10 files changed

+18
-20
lines changed

10 files changed

+18
-20
lines changed

Controllers/userController.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ const registerUser = async (req, res) => {
7575
})
7676
);
7777
//Using this so we don't send the actual hash to the front-end
78-
7978
user.password = "******";
8079

8180
logger.info(`User Added Successfully`, { log: JSON.stringify(user) });
@@ -142,7 +141,7 @@ const loginUser = async (req, res) => {
142141
//This logs the user out the app by removing the
143142
//Users token
144143
const logout = (req, res) => {
145-
res.clearCookie("token", {
144+
res.clearCookie("authToken", {
146145
httpOnly: true,
147146
secure: true,
148147
sameSite: "None",

Routes/User.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const auth = require("../middleware/auth")
66

77

88
router.get("/authorized", auth, userController.authorized);
9-
router.get("/logout", userController.logout);
9+
router.post("/logout", userController.logout);
1010
router.post("/login", rateLimiter, userController.loginUser);
1111
router.post("/register", rateLimiter, userController.registerUser);
1212
router.patch("/updateaccount", auth, userController.updateAccount);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "building-u-feedback-api",
3-
"version": "v0.4.0-alpha",
3+
"version": "v0.4.1-alpha",
44
"description": "This is for the server api that serves the app",
55
"main": "index.js",
66
"scripts": {

views/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "building-u-feedback",
3-
"version": "v0.2.0-alpha",
3+
"version": "v0.2.1-alpha",
44
"homepage": "https://buildingu.github.io/Building-u-feedback",
55
"type": "module",
66
"scripts": {

views/src/App.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ function App() {
2222
<Route path="/mentor/*" element={<AuthWrapper>{({ user }) => <Mentordashboard user={user} />}</AuthWrapper>} />
2323
<Route path="/feedback/:id" element={<AuthWrapper>{({ user }) => <SingleFeedBack user={user} />}</AuthWrapper>} />
2424
<Route path="/403" element={<Unauthorized />} />
25-
<Route path="/404" element={<Notfound />} />
25+
{/* wasnt sure how to do this correctly but this route enables pages that dont match our routes to land
26+
on the 404 page */}
27+
<Route path="*" element={<Notfound />} />
2628
</Routes>
2729
</MantineProvider>
2830
);

views/src/Pages/Interndashboard.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Account from '../Pages/Account/';
99
import TopBar from '../components/TopBar';
1010

1111
function Interndashboard(props) {
12-
const mockdata = [
12+
const navItems = [
1313
{ icon: IconFilePlus, label: 'Create Feedback request', to: 'requestform' },
1414
{ icon: IconClipboardText, label: 'Feedback Requests', to: 'myrequests' },
1515
{ icon: IconUser, label: 'Account', to: 'account' },
@@ -20,7 +20,7 @@ function Interndashboard(props) {
2020
return (
2121
<div style={{ display: 'flex', flexDirection: 'column-reverse' }}>
2222
<TopBar user={props.user} />
23-
<Sidebar navItems={mockdata} />
23+
<Sidebar navItems={navItems} />
2424
<Routes location={location}>
2525
<Route path="/requestform" element={<FeedbackRequestForm active={0} user={props.user}/>} />
2626
<Route path="/myrequests" element={<CreatedRequests active={1} user={props.user}/>} />

views/src/Pages/LoginPage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function LoginPage() {
132132
<div style={{ marginTop: "1.5rem" }}>
133133
<Group position="center" align="center" spacing="xs">
134134
<Text size="lg" c="dimmed">
135-
Don't An Account?
135+
Don't Have An Account?
136136
</Text>
137137
<Anchor onClick={navigateToLogin} size="lg" component="button">
138138
Sign Up

views/src/Pages/Signup.jsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from "react";
22
import { useForm } from "@mantine/form";
33
import { useNavigate } from "react-router-dom";
4-
import { useDispatch } from "react-redux"; // Import useDispatch
5-
import { setUser } from "../features/Auth/authSlice"; // Import your auth slice actions
4+
import { useDispatch } from "react-redux";
5+
import { setUser } from "../features/Auth/authSlice";
66
import axios from "axios";
77
import {
88
TextInput,
@@ -49,10 +49,9 @@ function Signup() {
4949
});
5050

5151
const handleFormSubmit = async () => {
52-
// Trigger form validation
5352
form.validate();
5453

55-
if (form.isValid) {
54+
if (form.isValid()) {
5655
const userData = {
5756
fName: form.values.fName,
5857
userName: form.values.userName,
@@ -62,7 +61,8 @@ function Signup() {
6261
try {
6362
const response = await axios.post(
6463
`${baseUrl}/api/users/register`,
65-
userData
64+
userData,
65+
{ withCredentials: true }
6666
);
6767

6868
if (response.status === 201) {
@@ -80,9 +80,6 @@ function Signup() {
8080
} catch (error) {
8181
console.error("Error submitting the form data:", error);
8282
}
83-
} else {
84-
// Handle the case when the form is not valid (TBD)
85-
return;
8683
}
8784
};
8885

views/src/features/Auth/authSlice.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ const initialState = {
1515
export const logoutUser = createAsyncThunk('auth/logout', async (_, thunkAPI) => {
1616

1717
try {
18-
await axios.get(
19-
`${baseUrl}/api/users/logout'`,
18+
await axios.post(
19+
`${baseUrl}/api/users/logout`,
2020
{
2121
withCredentials: true
2222
}

views/vite.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import react from '@vitejs/plugin-react';
44
// https://vitejs.dev/config/
55
export default defineConfig({
66
plugins: [react()],
7-
base: '/Building-u-feedback/',
7+
base: '/Building-u-feedback',
88

99
////Uncomment for local development only
1010
// server: {

0 commit comments

Comments
 (0)