fix url Tracker/tickets

This commit is contained in:
Никита Губарь 2024-07-04 18:04:28 +03:00
parent a367f8b09c
commit d45e600c93
6 changed files with 1119 additions and 1129 deletions

View File

@ -3,6 +3,8 @@ import React, { useState } from "react";
import DatePicker from "react-datepicker"; import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css"; import "react-datepicker/dist/react-datepicker.css";
import { apiRequest } from "@api/request";
import BaseButton from "@components/Common/BaseButton/BaseButton"; import BaseButton from "@components/Common/BaseButton/BaseButton";
import "./modalTicketToReport.scss"; import "./modalTicketToReport.scss";
@ -17,9 +19,12 @@ const ModalTicketToReport = ({ show, onClose, additionalData }) => {
}; };
try { try {
await axios.post( await apiRequest(
"https://itguild.info/profile/calendar/reports/create", "https://back.itguild.info/profile/calendar/reports/create",
data {
method: "POST",
data: data
}
); );
} catch (error) { } catch (error) {
console.error("Error:", error); console.error("Error:", error);

View File

@ -1,7 +1,7 @@
import moment from "moment"; import moment from "moment";
import React, { useEffect, useRef, useState } from "react"; import React, { useEffect, useRef, useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { Link, useLocation, useNavigate, useParams } from "react-router-dom"; import { Link, useParams } from "react-router-dom";
import { import {
activeLoader, activeLoader,
@ -51,8 +51,6 @@ import avatarMok from "assets/images/avatarMok.webp";
export const ProjectTracker = () => { export const ProjectTracker = () => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const projectId = useParams(); const projectId = useParams();
const location = useLocation();
const navigate = useNavigate();
const [openColumnSelect, setOpenColumnSelect] = useState({}); const [openColumnSelect, setOpenColumnSelect] = useState({});
const [selectedTab, setSelectedTab] = useState(0); const [selectedTab, setSelectedTab] = useState(0);
@ -99,24 +97,6 @@ export const ProjectTracker = () => {
} else { } else {
setFilteredNoTasks(false); setFilteredNoTasks(false);
} }
const path = location.pathname;
const match = path.match(/\/task\/(\d+)/);
console.log(match);
if (match) {
const extractedTaskId = match[1];
console.log(extractedTaskId);
// Убираем /task/id из URL
const newUrl = path.replace(/\/task\/\d+/, "");
navigate(newUrl, { replace: true });
// Открываем тикет
console.log("asd", projectBoard);
const Dtask = tasks.find((task) => task.id === extractedTaskId);
console.log("asd", Dtask);
// openTicket(extractedTaskId);
}
}, [projectBoard]); }, [projectBoard]);
function dragOverHandler(e) { function dragOverHandler(e) {
@ -174,9 +154,11 @@ export const ProjectTracker = () => {
document.body.style.overflow = "hidden"; document.body.style.overflow = "hidden";
} }
// useEffect(() => { useEffect(() => {
const currentUrl = window.location.pathname;
// }, [location]); const newUrl = currentUrl.replace(/\/task\/\d+$/, "");
window.history.replaceState({}, "", newUrl);
}, []);
function deleteColumn(column) { function deleteColumn(column) {
const priorityColumns = []; const priorityColumns = [];

View File

@ -5,7 +5,6 @@ import { useSort } from "@table-library/react-table-library/sort";
import { useTheme } from "@table-library/react-table-library/theme"; import { useTheme } from "@table-library/react-table-library/theme";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { Link } from "react-router-dom";
import { import {
getProjects, getProjects,

View File

@ -26,7 +26,6 @@ export const DeveloperPage = () => {
path="/tracker/project/:id/task/:taskId" path="/tracker/project/:id/task/:taskId"
element={<ProjectTracker />} element={<ProjectTracker />}
/> />
<Route exact path="/tracker/project/:id" element={<ProjectTracker />} /> <Route exact path="/tracker/project/:id" element={<ProjectTracker />} />
<Route exact path="profile"> <Route exact path="profile">

View File

@ -27,6 +27,11 @@ export const PartnerPage = () => {
<Route exact path="/candidate/:id/form" element={<FormPage />} /> <Route exact path="/candidate/:id/form" element={<FormPage />} />
<Route path="/:userId/calendar" element={<Calendar />} /> <Route path="/:userId/calendar" element={<Calendar />} />
<Route
exact
path="/tracker/project/:id/task/:taskId"
element={<ProjectTracker />}
/>
<Route exact path="/tracker/project/:id" element={<ProjectTracker />} /> <Route exact path="/tracker/project/:id" element={<ProjectTracker />} />
<Route exact path="profile"> <Route exact path="profile">