From 4f613f492ef72cdd3320d2c664cbcb3eb01b1e97 Mon Sep 17 00:00:00 2001
From: M1kola
Date: Thu, 13 Jul 2023 02:03:40 +0300
Subject: [PATCH] file
---
.../Modal/Tracker/ModalTicket/ModalTicket.jsx | 54 ++++++++++++++++---
.../Tracker/ModalTicket/modalTicket.scss | 13 +++++
src/pages/Tracker/tracker.scss | 4 +-
3 files changed, 62 insertions(+), 9 deletions(-)
diff --git a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx
index fda057ab..199ba498 100644
--- a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx
+++ b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx
@@ -10,7 +10,7 @@ import { Link } from "react-router-dom";
import { getProfileInfo } from "@redux/outstaffingSlice";
import { setProjectBoardFetch } from "@redux/projectsTrackerSlice";
-import { caseOfNum, getCorrectRequestDate, urlForLocal } from "@utils/helper";
+import {caseOfNum, getCorrectRequestDate, getToken, urlForLocal} from "@utils/helper";
import { apiRequest } from "@api/request";
@@ -63,6 +63,7 @@ export const ModalTiсket = ({
const [executor, setExecutor] = useState(task.executor);
const [members, setMembers] = useState(task.taskUsers);
const [users, setUsers] = useState([]);
+ const [selectedFile, setSelectedFile] = useState(null)
const [timerStart, setTimerStart] = useState(false);
const [timerInfo, setTimerInfo] = useState({});
const [currentTimerCount, setCurrentTimerCount] = useState({
@@ -302,6 +303,32 @@ export const ModalTiсket = ({
}
}, []);
+ const handleUpload = async (event) => {
+
+ const formData = new FormData()
+ formData.append('uploadFile ', event.target.files[0])
+ // apiRequest('/file/upload', {
+ // method: 'POST',
+ // data: {
+ // formData
+ // }
+ // }).then((res) => {
+ // console.log(res)
+ // })
+ // console.log(formData)
+ const res = await fetch('https://itguild.info/file/upload', {
+ method: 'POST',
+ body: formData,
+ headers: {
+ "Access-Control-Allow-Origin": "*",
+ "Content-Type": "application/json",
+ ...getToken()
+ }
+ })
+
+ console.log(res)
+ }
+
function startTimer() {
setTimerId(
setInterval(() => {
@@ -447,14 +474,27 @@ export const ModalTiсket = ({
{/* Добавить под задачу*/}
{/* */}
{/*
*/}
-
-
+
+
+
+
+
{0}
{caseOfNum(0, "files")}
-
+