Skip to content

Commit

Permalink
netlify error and css bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shelcia committed Sep 6, 2020
1 parent ac855c5 commit 4ee3694
Show file tree
Hide file tree
Showing 13 changed files with 197 additions and 301 deletions.
51 changes: 51 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
"from": "^0.1.7",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-loader-spinner": "^3.1.14",
"react-redux": "^7.2.1",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"react-toastify": "^6.0.8",
"redux": "^4.0.5"
},
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions public/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* /index.html 200
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="logo.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
Expand Down
Binary file added public/logo.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions public/netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[[redirects]]
from="/"
to="/index.html"
status=200
4 changes: 3 additions & 1 deletion src/components/LandingPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,23 @@ const LandingPage = () => {
<Link to="/employeelogin">
<img src={Employee} alt="employee" />
</Link>
<p>Employee</p>
</div>
<div className="card">
<Link to="/managerlogin">
<img src={Manager} alt="manager" />
</Link>
<p>Manager</p>
</div>
<div className="card">
<Link to="/adminlogin">
<img src={Admin} alt="admin" />
</Link>
<p>Admin</p>
</div>
</div>
</div>
</div>
<nav></nav>
</React.Fragment>
);
};
Expand Down
93 changes: 52 additions & 41 deletions src/components/admin/AdminLogin.jsx
Original file line number Diff line number Diff line change
@@ -1,75 +1,86 @@
import React, { useState } from "react";
import axios from "axios";
import { useHistory } from "react-router-dom";
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import Loader from "react-loader-spinner";
import "react-loader-spinner/dist/loader/css/react-spinner-loader.css";

import Illustration from "../../assets/illustration.png";

const AdminLogin = () => {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [display, setDisplay] = useState("hide");
const [message, setMessage] = useState("");
const [isLoading, setLoading] = useState(false);

const history = useHistory();

const classname =
display === "show" ? "badge-container show" : "badge-container hide";
const ErrorNotify = () => toast.error("Please enter correct Credentials");
// const waitNotify = () => toast.info("Please wait while we verify");

const loginUser = async (e) => {
setLoading(true);
e.preventDefault();
console.log("clicked");
// waitNotify();
const response = { email: email, password: password };
try {
const result = await axios.post(
"https://crm-backend-nodejs.herokuapp.com/api/admin/login",
response
);
setLoading(false);
localStorage.setItem("token", result.data);
setDisplay("show");
setMessage("successfull login");
history.push("/admindashboard/servicerequest");
} catch (e) {
setLoading(false);
ErrorNotify();
console.log(`Axios request failed: ${e}`);
setDisplay("show");
setMessage(e);
}
};
return (
<React.Fragment>
<div className={classname}>{message.toString()}</div>
<div className="login-container">
<div className="flexbox">
<div className="illustrator">
<img src={Illustration} alt="illustration" />
</div>
<div className="login">
<div className="headliner">Admin Signin</div>
<input
type="text"
placeholder="enter email-id"
onChange={(e) => setEmail(e.target.value)}
/>
<input
type="password"
placeholder="enter password"
onChange={(e) => setPassword(e.target.value)}
/>
<button type="button" onClick={(e) => loginUser(e)}>
Login
</button>
<button
type="button"
style={{ marginLeft: "2rem" }}
onClick={(event) => {
event.preventDefault();
history.push("/#Login");
}}
>
Back
</button>
<ToastContainer />
{isLoading && (
<div className="loading">
<Loader type="Clock" color="#897eff" height={100} width={100} />
<p>Please wait while we verify....</p>
</div>
)}
{!isLoading && (
<div className="login-container">
<div className="flexbox">
<div className="illustrator">
<img src={Illustration} alt="illustration" />
</div>
<div className="login">
<div className="headliner">Admin Signin</div>
<input
type="text"
placeholder="enter email-id"
onChange={(e) => setEmail(e.target.value)}
/>
<input
type="password"
placeholder="enter password"
onChange={(e) => setPassword(e.target.value)}
/>
<button type="button" onClick={(e) => loginUser(e)}>
Login
</button>
<button
type="button"
style={{ marginLeft: "2rem" }}
onClick={(event) => {
event.preventDefault();
history.push("/#Login");
}}
>
Back
</button>
</div>
</div>
</div>
</div>
)}
</React.Fragment>
);
};
Expand Down
26 changes: 13 additions & 13 deletions src/components/admin/ServiceRequest/EditService.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const EditService = ({
}) => {
const [results, setResults] = useState([]);
const services = results.filter((result) => result._id === id);
console.log(services);
// console.log(services);
const [title, setTitle] = useState(Title);
const [client, setClient] = useState(Client);
const [manager, setManager] = useState(Manager);
Expand All @@ -28,17 +28,17 @@ const EditService = ({
const [status, setStatus] = useState(Probability);
const history = useHistory();

console.log(
id,
Title,
Client,
Manager,
Closing,
Priority,
Status,
Revenue,
Probability
);
// console.log(
// id,
// Title,
// Client,
// Manager,
// Closing,
// Priority,
// Status,
// Revenue,
// Probability
// );

useEffect(() => {
const url =
Expand Down Expand Up @@ -95,7 +95,7 @@ const EditService = ({
</div>
<div className="main-content">
<div className="header">
<div className="title">Service</div>
<div className="title">Edit Service Request</div>
</div>
<hr />
<div className="content">
Expand Down
10 changes: 10 additions & 0 deletions src/components/employee/EmployeeLogin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ const EmployeeLogin = () => {
<button type="button" onClick={(e) => loginUser(e)}>
Login
</button>
<button
type="button"
style={{ marginLeft: "2rem" }}
onClick={(event) => {
event.preventDefault();
history.push("/#Login");
}}
>
Back
</button>
{/* <Link to="/employeelogin">Go to Employee Login Page</Link>
<Link to="/managerlogin">Go to Manager Login Page</Link> */}
</div>
Expand Down
Loading

0 comments on commit 4ee3694

Please sign in to comment.