diff --git a/client/public/index.html b/client/public/index.html index de0ef70..a3513c7 100644 --- a/client/public/index.html +++ b/client/public/index.html @@ -1,25 +1,20 @@ - - - - - - - - - - - - Aiinterviewer - - - - - -
- - - + + \ No newline at end of file diff --git a/client/src/api/index.js b/client/src/api/index.js index 7254063..fdf9d4f 100644 --- a/client/src/api/index.js +++ b/client/src/api/index.js @@ -1,16 +1,10 @@ -import axios from 'axios' -import dotenv from 'dotenv' +import axios from 'axios'; +import dotenv from 'dotenv'; dotenv.config() -const NODE_ENV = process.env.NODE_ENV -let url; -if (NODE_ENV === 'development') { - url = 'http://localhost:5000' -} else { - url = process.env.REACT_APP_API -} -export const baseURL = url; +const baseURL = process.env.REACT_APP_API; +console.log('baseURl is ', baseURL) const API = axios.create({ baseURL: baseURL}) export const AI_URL = process.env.AI_APP_API; const AI_APP_API = axios.create({ baseURL: 'http://localhost:8000'}) diff --git a/client/src/components/SeeScheduledInterviews/SeeScheduledInterviews.js b/client/src/components/SeeScheduledInterviews/SeeScheduledInterviews.js index e712dc0..8fbe8f5 100644 --- a/client/src/components/SeeScheduledInterviews/SeeScheduledInterviews.js +++ b/client/src/components/SeeScheduledInterviews/SeeScheduledInterviews.js @@ -39,7 +39,7 @@ const SeeScheduledInterviews = () => { ({ id, role } = checkUserRole(user)); setUserRole(role); } - + console.log("id", id); const fetchData = async (id) => { try { let response = null; @@ -48,6 +48,7 @@ const SeeScheduledInterviews = () => { } else if (userRole === "hr") { response = await dispatch(getInterviewsHR(id)); } + console.log(response); if (response && response[0]) { // Sort interviews by date and time before setting the state const sortedInterviews = response.sort((a, b) => { @@ -66,8 +67,10 @@ const SeeScheduledInterviews = () => { setDataFetched(true); } else if (!response[0]) { openSnackbar("Loading interviews"); + setDataFetched(true); } else { openSnackbar("Failed to get interviews"); + setDataFetched(true); } } catch (error) { openSnackbar("Loading Interviews"); diff --git a/client/src/components/UpdateProfile/UpdateProfile.js b/client/src/components/UpdateProfile/UpdateProfile.js index 7d3dc0e..1b2dad0 100644 --- a/client/src/components/UpdateProfile/UpdateProfile.js +++ b/client/src/components/UpdateProfile/UpdateProfile.js @@ -122,18 +122,17 @@ const UpdateProfile = () => { const fetchData = async (id) => { try { let response = await dispatch(getProfile(id)); - + if (response) { - let technicalSkills = response.technicalSkills[0].split(",").map(skill => skill.trim()); - let softSkills = response.softSkills[0].split(",").map(skill => skill.trim()); + console.log(response) setInitialData({ company: response.company, firstName: response.firstName, lastName: response.lastName, dob: response.dob, - technicalSkills: technicalSkills, + technicalSkills: response.technicalSkills, experience: response.experience, - softSkills: softSkills, + softSkills: response.softSkills, education: response.education, strengths: response.strengths, weaknesses: response.weaknesses, diff --git a/server/src/controllers/user.ts b/server/src/controllers/user.ts index 19ecc13..aeb4a4e 100644 --- a/server/src/controllers/user.ts +++ b/server/src/controllers/user.ts @@ -1,6 +1,6 @@ import axios from "axios"; import bcrypt from "bcryptjs"; -import jwt from 'jsonwebtoken' +import jwt from 'jsonwebtoken'; // @ts-ignore import dotenv from "dotenv"; import { Request, Response } from "express"; @@ -110,6 +110,10 @@ export const signup = async (req: Request, res: Response): Promise => { return; } + if (role == null) { + res.status(400).json({message: 'Invalid details. user role is required.'}) + } + const existingUser = await User.findOne({ email }); if (existingUser) res.status(400).json({ message: "User already exists" }); diff --git a/server/src/index.ts b/server/src/index.ts index 9254719..b8f8e09 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -40,7 +40,7 @@ app.get('/', (req: Request, res: Response) => { res.send('Server is ready'); }); -const PORT: number = 5000; +const PORT: number = 8000; server.listen(PORT, () => { console.log(`Server running at http://localhost:${PORT}`);