Skip to content

Commit 399fafe

Browse files
pre build
1 parent c2d3c45 commit 399fafe

File tree

9 files changed

+40
-17
lines changed

9 files changed

+40
-17
lines changed

client/src/components/form_parts/FIO.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ const FIO: FC = () => {
88
const { register, formState: { errors }, watch } = useFormContext<FractionAndFIO>();
99

1010
const isR = watch('isRepresentative')
11-
const [isRes, setIsRes] = useState<boolean>(false)
11+
const [isRes, setIsRes] = useState<string>('true')
1212

1313
const fraction = watch('fraction')
1414
const [fractionState, setFractionState] = useState<'в доле' | 'га'>('в доле')
1515

16-
useEffect(() => {
17-
setIsRes((prev) => !prev)
18-
}, [isR])
16+
useEffect(() => {
17+
console.log(isR)
18+
setIsRes(String(isR));
19+
}, [isR]);
20+
1921
useEffect(() => {
2022
setFractionState(fraction)
2123
}, [fraction])
@@ -44,8 +46,8 @@ const FIO: FC = () => {
4446
/>
4547
</div>
4648
<div>
47-
{isRes && <label htmlFor="name_res">ФИО Представителя</label>}
48-
{isRes && <input
49+
{isRes == 'true' && <label htmlFor="name_res">ФИО Представителя</label>}
50+
{isRes == 'true' && <input
4951
type="text"
5052
id="name_res"
5153
placeholder='Иванов Иван Иванович'

client/src/hooks/useAlertUpload.hook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useEffect } from 'react';
33

44
export const useUnloadWarning = (enabled: boolean) => {
55
useEffect(() => {
6-
const handleBeforeUnload = (e: BeforeUnloadEvent) => {
6+
const handleBeforeUnload = (e: any) => {
77
e.preventDefault();
88
e.returnValue = ''; // Необходимо для срабатывания в некоторых браузерах
99
};

client/tsconfig.app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"moduleDetection": "force",
2727
"jsx": "react-jsx",
2828
"noEmit": true,
29-
"lib": ["es2017", "dom"],
29+
"lib": ["es2017", "DOM", "DOM.Iterable"],
3030
"isolatedModules": true,
3131
"noFallthroughCasesInSwitch": true
3232
},

client/tsconfig.app.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

client/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{ "path": "./tsconfig.node.json" }
66
],
77
"compilerOptions": {
8+
"lib": ["DOM"],
89
"baseUrl": ".",
910
"paths": {
1011
"@components/*": ["./src/components/*"],
@@ -16,4 +17,6 @@
1617
}
1718
},
1819

20+
21+
1922
}

client/tsconfig.node.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compilerOptions": {
44
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
55
"target": "ES2022",
6-
"lib": ["ES2023"],
6+
"lib": ["ES2023", "DOM"],
77
"module": "ESNext",
88
"skipLibCheck": true,
99

client/types/Fetch.type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GeneralInfo, GeneralInfoToServer, VariousInfoToServer } from "./Form.type"
1+
import { GeneralInfoToServer, VariousInfoToServer } from "./Form.type"
22

33
export interface HiType {
44
id?: number,

server/package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@
77
"server": "nodemon server.js --verbose",
88
"client": "npm run dev --prefix ../client",
99
"start": "concurrently \"npm run server\" \"npm run client\"",
10-
"build": "tsc",
11-
"prod": "npm run build && node dist/server.js",
12-
"dev": "nodemon server.ts"
10+
"dev": "nodemon server.ts",
11+
12+
"copy-static": "xcopy static dist\\static /E /I /Y",
13+
"build": "rmdir /S /Q dist && tsc -b && npm run copy-static",
14+
15+
"copy-static-linux": "cp -r static dist/static",
16+
"build-linux": "rm -rf dist && tsc -b && npm run copy-static",
17+
18+
"prod": "npm run build && node dist/server.js"
1319
},
1420
"keywords": [],
1521
"author": "",

server/server.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import express, {Request, Response, Express} from "express"
1+
import express, { Request, Response, Express } from "express"
22
import { config } from "dotenv";
33
import mainRouter from "./routes/main.route"
44
import path from "path"
@@ -10,15 +10,27 @@ config()
1010

1111
const PORT = process.env.PORT || 80
1212

13-
app.use(cors({origin: 'localhost:3000'}))
13+
app.use(cors({ origin: 'localhost:3000' }))
1414
app.use(express.json());
15+
1516
app.use(express.static(path.join(__dirname, "static")))
17+
1618
app.use(bodyParser.json({ limit: "100mb" }))
1719
app.use(bodyParser.urlencoded({ limit: '100mb', extended: true }));
1820

1921

2022
//Rotes
21-
app.use('/api', mainRouter)
23+
app.use('/api', mainRouter);
24+
25+
try {
26+
app.use(express.static(path.join(__dirname, '..', '..', 'client', 'dist')))
27+
app.use((req: Request, res: Response) => {
28+
res.sendFile(path.join(__dirname, "..", '..', "client", 'dist'))
29+
})
30+
} catch (error) {
31+
console.error(error)
32+
}
33+
2234

2335

2436
app.listen(PORT, () => {

0 commit comments

Comments
 (0)