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

All the final changes of docker and other files were done #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Styling issues and general fixes
SanjamSinghKalsi committed Jul 18, 2021
commit 4d36ee052523e61677c6721dfe28b1bc4cbd0d0b
1 change: 1 addition & 0 deletions client/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_API_KEY=http://localhost:3000
3 changes: 3 additions & 0 deletions client/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
REACT_APP_API_KEY=https://askfeed-api.springrole.com/

# npm start se production wale prr hit hoga.
47 changes: 47 additions & 0 deletions client/package-lock.json

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

4 changes: 3 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.21.1",
"env-cmd": "^10.1.0",
"http-proxy-middleware": "^2.0.0",
"install": "^0.13.0",
"lodash": "^4.17.21",
@@ -25,7 +26,8 @@
"web-vitals": "^1.1.2"
},
"scripts": {
"start": "react-scripts start",
"start": "env-cmd -f .env.production react-scripts start",
"dev": "env-cmd -f .env.development react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
4 changes: 2 additions & 2 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -10,10 +10,10 @@
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link
<!-- <link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
/>
/> -->
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
6 changes: 4 additions & 2 deletions client/src/actions/index.js
Original file line number Diff line number Diff line change
@@ -2,13 +2,15 @@ import axios from "axios";
import { FETCH_USER, FETCH_SURVEYS } from "./types";
export const submitSurvey = (values, history) => async (dispatch) => {
const res = await axios.post(
"http://localhost:2000/survey/createsurvey",
`${process.env.REACT_APP_API_KEY}/survey/createsurvey`,
values
);
dispatch({ type: FETCH_USER, payload: res.data });
};

export const fetchSurveys = () => async (dispatch) => {
const res = await axios.get("http://localhost:2000/survey/getSurvey");
const res = await axios.get(
`${process.env.REACT_APP_API_KEY}/survey/getSurvey`
);
dispatch({ type: FETCH_SURVEYS, payload: res.data });
};
3 changes: 1 addition & 2 deletions client/src/components/ActivationEmail.js
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ function ActivationEmail() {
const activationEmail = async () => {
try {
const res = await axios.post(
`http://localhost:2000/api/activate/${token}`,
`${process.env.REACT_APP_API_KEY}/api/activate/${token}`,
{
token,
}
@@ -55,4 +55,3 @@ function ActivationEmail() {
);
}
export default ActivationEmail;

2 changes: 1 addition & 1 deletion client/src/components/LandingPage/LandingPage.css
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ body {
font-weight: bold;
font-size: 2.5rem;
line-height: 3rem;
padding-left: 142rem;
padding-left: 25rem;
/* identical to box height */
color: #3362a8;
}
2 changes: 1 addition & 1 deletion client/src/components/Login.js
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ const Login = () => {

const loginUser = async (e) => {
e.preventDefault();
const res = await fetch("/api/login", {
const res = await fetch(`${process.env.REACT_APP_API_KEY}/api/login`, {
method: "POST",
headers: {
"Content-type": "application/json",
1 change: 1 addition & 0 deletions client/src/components/Logout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect } from "react";
import { useHistory } from "react-router-dom";
// import "materialize-css/dist/css/materialize.min.css";

const Logout = () => {
const history = useHistory();
9 changes: 6 additions & 3 deletions client/src/components/ResetLink.js
Original file line number Diff line number Diff line change
@@ -18,9 +18,12 @@ const ResetLink = () => {

const forgetPassword = async () => {
try {
const res = await axios.post("http://localhost:3000/api/resetlink", {
email,
});
const res = await axios.post(
`${process.env.REACT_APP_API_KEY}/api/resetlink`,
{
email,
}
);
return setData({ ...data, err: "", success: res.data.msg });
} catch (err) {
console.log(err);
2 changes: 1 addition & 1 deletion client/src/components/ResetPassword.js
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ function ResetPassword() {
const handleResetPassword = async () => {
try {
const res = await axios.post(
`http://localhost:2000/api/changepassword/${token}`,
`${process.env.REACT_APP_API_KEY}/api/changepassword/${token}`,
{ password },
{
headers: { Authorization: token },
4 changes: 2 additions & 2 deletions client/src/components/Signup.js
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ const Signup = () => {
const PostData = async (e) => {
e.preventDefault();
const { name, email, phone, password } = user;
const res = await fetch("/api/signup", {
const res = await fetch(`${process.env.REACT_APP_API_KEY}/api/signup`, {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -40,7 +40,7 @@ const Signup = () => {
window.alert("Invalid!");
console.log("Invalid!");
} else {
window.alert("Sucess!");
window.alert("Success! Please go to your mail to verify!");
console.log(data);
history.push("/login");
}
3 changes: 1 addition & 2 deletions client/src/components/surveys/StoringNo.js
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ function StoringNo() {
const activationEmail = async () => {
try {
const res = await axios.put(
`http://localhost:2000/survey/response/no/${id}`,
`${process.env.REACT_APP_API_KEY}/survey/response/no/${id}`,
{
id,
}
@@ -38,4 +38,3 @@ function StoringNo() {
);
}
export default StoringNo;

3 changes: 1 addition & 2 deletions client/src/components/surveys/StoringYes.js
Original file line number Diff line number Diff line change
@@ -8,13 +8,12 @@ function StoringYes() {
const [err, setErr] = useState("");
const [success, setSuccess] = useState("");


useEffect(() => {
if (id) {
const activationEmail = async () => {
try {
const res = await axios.put(
`http://localhost:2000/survey/response/yes/${id}`,
`${process.env.REACT_APP_API_KEY}/survey/response/yes/${id}`,
{
id,
}
2 changes: 1 addition & 1 deletion client/src/components/surveys/SurveyList.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from "react";
import { connect } from "react-redux";
import { fetchSurveys } from "../../actions";
// import "materialize-css/dist/css/materialize.min.css";

class SurveyList extends Component {
componentDidMount() {
@@ -46,4 +47,3 @@ function mapStateToProps({ surveys }) {
}

export default connect(mapStateToProps, { fetchSurveys })(SurveyList);

55 changes: 55 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"env-cmd": "^10.1.0",
"express": "^4.17.1"
},
"scripts": {