Commit ae181170 authored by Ibadullina Inabat's avatar Ibadullina Inabat

внесены изменения в бэк часть, убрали express-async-errors и добавлены условия в…

внесены изменения в бэк часть, убрали express-async-errors и добавлены условия в переменную frontend-url
parent 6aa26355
import 'express-async-errors';
import express, { NextFunction, Request, Response, Router } from "express";
// import 'express-async-errors';
// import expressAsyncErrors from 'express-async-errors';
import express, { NextFunction, Request, Response } from "express";
import { myDataSource } from "./app-data-source";
import { Task } from "./models/Task";
import { User } from "./models/User";
......@@ -188,7 +189,7 @@ export const memberFinderById = async (userId:string, projectId:string):Promise<
}
export let transporter = nodemailer.createTransport({
export const transporter = nodemailer.createTransport({
service:'Yandex',
// host: "smtp.yandex.ru",
// port: 465,
......@@ -207,6 +208,8 @@ export let transporter = nodemailer.createTransport({
}
export const FRONTEND_URL = 'localhost:3000';
export let frontend_url = 'localhost:3000';
if (process.env.REACT_APP_NODE_ENV === "dev") {
frontend_url = "http://116.203.144.156:3000"
}
......@@ -4,7 +4,7 @@ import {myDataSource} from '../app-data-source';
import { nanoid } from 'nanoid';
import { PasswordRecovery } from '../models/PasswordRecovery';
import { transporter } from '../helpers';
import {FRONTEND_URL} from "../helpers";
import {frontend_url} from "../helpers";
import {SALT_WORK_FACTOR} from "../models/User";
import bcrypt from 'bcrypt';
const router:Router = express.Router();
......@@ -31,7 +31,7 @@ router.post ('/', async (req:Request, res:Response):Promise<void |Response>=>{
passwordRecovery.token=token;
await passwordRecovery.save()
console.log('passwordRecover ' , passwordRecovery)
const url = `${FRONTEND_URL}/reset-password/${token}`;
const url = `${frontend_url}/reset-password/${token}`;
await transporter.sendMail({
from:"planner45@yandex.com",
to: `${email}`,
......
import 'express-async-errors';
// import 'express-async-errors';
import express,{Router, Request, Response } from 'express';
import {Task} from '../models/Task';
import {myDataSource} from '../app-data-source';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment