Skip to content

Commit

Permalink
Merge pull request #33 from buildingu/chore-fix-various-fixes
Browse files Browse the repository at this point in the history
Patch for release 4.0.1-alpha
  • Loading branch information
gbudjeakp authored Jul 7, 2024
2 parents 9e854ef + 15cefe1 commit 183d1a8
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 20 deletions.
3 changes: 1 addition & 2 deletions Controllers/userController.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ const registerUser = async (req, res) => {
})
);
//Using this so we don't send the actual hash to the front-end

user.password = "******";

logger.info(`User Added Successfully`, { log: JSON.stringify(user) });
Expand Down Expand Up @@ -142,7 +141,7 @@ const loginUser = async (req, res) => {
//This logs the user out the app by removing the
//Users token
const logout = (req, res) => {
res.clearCookie("token", {
res.clearCookie("authToken", {
httpOnly: true,
secure: true,
sameSite: "None",
Expand Down
2 changes: 1 addition & 1 deletion Routes/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const auth = require("../middleware/auth")


router.get("/authorized", auth, userController.authorized);
router.get("/logout", userController.logout);
router.post("/logout", userController.logout);
router.post("/login", rateLimiter, userController.loginUser);
router.post("/register", rateLimiter, userController.registerUser);
router.patch("/updateaccount", auth, userController.updateAccount);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "building-u-feedback-api",
"version": "v0.4.0-alpha",
"version": "v0.4.1-alpha",
"description": "This is for the server api that serves the app",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion views/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "building-u-feedback",
"version": "v0.2.0-alpha",
"version": "v0.2.1-alpha",
"homepage": "https://buildingu.github.io/Building-u-feedback",
"type": "module",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion views/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ function App() {
<Route path="/mentor/*" element={<AuthWrapper>{({ user }) => <Mentordashboard user={user} />}</AuthWrapper>} />
<Route path="/feedback/:id" element={<AuthWrapper>{({ user }) => <SingleFeedBack user={user} />}</AuthWrapper>} />
<Route path="/403" element={<Unauthorized />} />
<Route path="/404" element={<Notfound />} />
{/* wasnt sure how to do this correctly but this route enables pages that dont match our routes to land
on the 404 page */}
<Route path="*" element={<Notfound />} />
</Routes>
</MantineProvider>
);
Expand Down
4 changes: 2 additions & 2 deletions views/src/Pages/Interndashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Account from '../Pages/Account/';
import TopBar from '../components/TopBar';

function Interndashboard(props) {
const mockdata = [
const navItems = [
{ icon: IconFilePlus, label: 'Create Feedback request', to: 'requestform' },
{ icon: IconClipboardText, label: 'Feedback Requests', to: 'myrequests' },
{ icon: IconUser, label: 'Account', to: 'account' },
Expand All @@ -20,7 +20,7 @@ function Interndashboard(props) {
return (
<div style={{ display: 'flex', flexDirection: 'column-reverse' }}>
<TopBar user={props.user} />
<Sidebar navItems={mockdata} />
<Sidebar navItems={navItems} />
<Routes location={location}>
<Route path="/requestform" element={<FeedbackRequestForm active={0} user={props.user}/>} />
<Route path="/myrequests" element={<CreatedRequests active={1} user={props.user}/>} />
Expand Down
2 changes: 1 addition & 1 deletion views/src/Pages/LoginPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function LoginPage() {
<div style={{ marginTop: "1.5rem" }}>
<Group position="center" align="center" spacing="xs">
<Text size="lg" c="dimmed">
Don't An Account?
Don't Have An Account?
</Text>
<Anchor onClick={navigateToLogin} size="lg" component="button">
Sign Up
Expand Down
13 changes: 5 additions & 8 deletions views/src/Pages/Signup.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";
import { useForm } from "@mantine/form";
import { useNavigate } from "react-router-dom";
import { useDispatch } from "react-redux"; // Import useDispatch
import { setUser } from "../features/Auth/authSlice"; // Import your auth slice actions
import { useDispatch } from "react-redux";
import { setUser } from "../features/Auth/authSlice";
import axios from "axios";
import {
TextInput,
Expand Down Expand Up @@ -49,10 +49,9 @@ function Signup() {
});

const handleFormSubmit = async () => {
// Trigger form validation
form.validate();

if (form.isValid) {
if (form.isValid()) {
const userData = {
fName: form.values.fName,
userName: form.values.userName,
Expand All @@ -62,7 +61,8 @@ function Signup() {
try {
const response = await axios.post(
`${baseUrl}/api/users/register`,
userData
userData,
{ withCredentials: true }
);

if (response.status === 201) {
Expand All @@ -80,9 +80,6 @@ function Signup() {
} catch (error) {
console.error("Error submitting the form data:", error);
}
} else {
// Handle the case when the form is not valid (TBD)
return;
}
};

Expand Down
4 changes: 2 additions & 2 deletions views/src/features/Auth/authSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const initialState = {
export const logoutUser = createAsyncThunk('auth/logout', async (_, thunkAPI) => {

try {
await axios.get(
`${baseUrl}/api/users/logout'`,
await axios.post(
`${baseUrl}/api/users/logout`,
{
withCredentials: true
}
Expand Down
2 changes: 1 addition & 1 deletion views/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import react from '@vitejs/plugin-react';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
base: '/Building-u-feedback/',
base: '/Building-u-feedback',

////Uncomment for local development only
// server: {
Expand Down

0 comments on commit 183d1a8

Please sign in to comment.