Skip to content

Commit 062ef3d

Browse files
author
shahriarsajeeb
committed
final code
1 parent f397dca commit 062ef3d

File tree

6 files changed

+16
-24
lines changed

6 files changed

+16
-24
lines changed

backend/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ const cors = require("cors");
77
const path = require("path");
88

99
app.use(cors({
10-
origin: '*',
10+
origin: 'https://eshop-tutorial-cefl.vercel.app',
1111
credentials: true
1212
}));
1313

1414
app.use(express.json());
1515
app.use(cookieParser());
16-
app.use("/", express.static(path.join(__dirname, "./uploads")));
16+
app.use("/", express.static(path.join(__dirname,"./uploads")));
1717
app.use("/test", (req, res) => {
1818
res.send("Hello world!");
1919
});

backend/config/.env

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
PORT =
2-
DB_URL =
3-
JWT_SECRET_KEY =
4-
JWT_EXPIRES =
5-
ACTIVATION_SECRET =
6-
SMPT_HOST =
7-
SMPT_PORT =
8-
SMPT_PASSWORD =
9-
SMPT_MAIL =
10-
STRIPE_API_KEY =
11-
STRIPE_SECRET_KEY =
1+
PORT = 8000
2+
DB_URL = "mongodb+srv://shahriarsajeeb:e-shop1234@cluster0.6dckvfx.mongodb.net/test"
3+
JWT_SECRET_KEY = "dfbkjgflseiia3948943954wfsdchsgfuw#%#%"
4+
JWT_EXPIRES = 7d
5+
ACTIVATION_SECRET = hfskjdweuiwe093$wew$@%W!Edfonoddfi
6+
SMPT_HOST = smtp.gmail.com
7+
SMPT_PORT = 465
8+
SMPT_PASSWORD = ezxxqmjhjdnfucdv
9+
SMPT_MAIL = support@becodemy.com
10+
STRIPE_API_KEY = pk_test_51KlcLFBK9PCk4OhCmCUGNNnJqLHcllocV6d5ipQEHXibYE0Rfi8vxULYBluJYRI7HmieplqMzZ2tCp6kDpyIZztI00n4yXPaWc
11+
STRIPE_SECRET_KEY = sk_test_51KlcLFBK9PCk4OhCKkvgwl13JW7d25lL6emYThvmMCCcGYDzzWWBtfLvXVj78txO88F3sRbCAcNQdaSPcsz5n4tC00OS0gAQqW

backend/controller/shop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ router.post("/create-shop", upload.single("file"), async (req, res, next) => {
4444

4545
const activationToken = createActivationToken(seller);
4646

47-
const activationUrl = `http://localhost:3000/seller/activation/${activationToken}`;
47+
const activationUrl = `https://eshop-tutorial-cefl.vercel.app/seller/activation/${activationToken}`;
4848

4949
try {
5050
await sendMail({

backend/controller/user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ router.post("/create-user", upload.single("file"), async (req, res, next) => {
4141

4242
const activationToken = createActivationToken(user);
4343

44-
const activationUrl = `http://localhost:3000/activation/${activationToken}`;
44+
const activationUrl = `https://eshop-tutorial-cefl.vercel.app/activation/${activationToken}`;
4545

4646
try {
4747
await sendMail({

backend/utils/jwtToken.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const sendToken = (user, statusCode, res) => {
66
const options = {
77
expires: new Date(Date.now() + 90 * 24 * 60 * 60 * 1000),
88
httpOnly: true,
9+
sameSite: "none",
910
Secure: true,
1011
};
1112

frontend/src/redux/actions/user.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ export const loadUser = () => async (dispatch) => {
99
});
1010
const { data } = await axios.get(`${server}/user/getuser`, {
1111
withCredentials: true,
12-
headers: {
13-
"Access-Control-Allow-Credentials": true,
14-
},
1512
});
1613
dispatch({
1714
type: "LoadUserSuccess",
@@ -33,9 +30,6 @@ export const loadSeller = () => async (dispatch) => {
3330
});
3431
const { data } = await axios.get(`${server}/shop/getSeller`, {
3532
withCredentials: true,
36-
headers: {
37-
"Access-Control-Allow-Credentials": true,
38-
},
3933
});
4034
dispatch({
4135
type: "LoadSellerSuccess",
@@ -158,9 +152,6 @@ export const getAllUsers = () => async (dispatch) => {
158152

159153
const { data } = await axios.get(`${server}/user/admin-all-users`, {
160154
withCredentials: true,
161-
headers: {
162-
"Access-Control-Allow-Credentials": true,
163-
},
164155
});
165156

166157
dispatch({

0 commit comments

Comments
 (0)