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

View File

@ -1,7 +1,7 @@
import moment from "moment";
import React, { useEffect, useRef, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { Link, useLocation, useNavigate, useParams } from "react-router-dom";
import { Link, useParams } from "react-router-dom";
import {
activeLoader,
@ -51,8 +51,6 @@ import avatarMok from "assets/images/avatarMok.webp";
export const ProjectTracker = () => {
const dispatch = useDispatch();
const projectId = useParams();
const location = useLocation();
const navigate = useNavigate();
const [openColumnSelect, setOpenColumnSelect] = useState({});
const [selectedTab, setSelectedTab] = useState(0);
@ -99,24 +97,6 @@ export const ProjectTracker = () => {
} else {
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]);
function dragOverHandler(e) {
@ -174,9 +154,11 @@ export const ProjectTracker = () => {
document.body.style.overflow = "hidden";
}
// useEffect(() => {
// }, [location]);
useEffect(() => {
const currentUrl = window.location.pathname;
const newUrl = currentUrl.replace(/\/task\/\d+$/, "");
window.history.replaceState({}, "", newUrl);
}, []);
function deleteColumn(column) {
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 React, { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { Link } from "react-router-dom";
import {
getProjects,

View File

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

View File

@ -27,6 +27,11 @@ export const PartnerPage = () => {
<Route exact path="/candidate/:id/form" element={<FormPage />} />
<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="profile">