fix: убрано состояние загрузки во время перетаскивания задач
This commit is contained in:
@@ -11,8 +11,11 @@ import {
|
|||||||
export const useBoardLogic = (id, setError, setInfo, setCategories, setLoading, setItems) => {
|
export const useBoardLogic = (id, setError, setInfo, setCategories, setLoading, setItems) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const loadBoardData = useCallback(async () => {
|
const loadBoardData = useCallback(async (ws) => {
|
||||||
|
if (!ws){
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setError('');
|
setError('');
|
||||||
const response = await loadBoardDataAPI(id);
|
const response = await loadBoardDataAPI(id);
|
||||||
@@ -112,14 +115,16 @@ export const useBoardLogic = (id, setError, setInfo, setCategories, setLoading,
|
|||||||
}, [loadBoardData, setLoading, setError]);
|
}, [loadBoardData, setLoading, setError]);
|
||||||
|
|
||||||
const editTask = useCallback(async (editedTaskId, taskTitle, taskDescription, taskPosition, taskDeadline, taskCategory, modalEditTask) => {
|
const editTask = useCallback(async (editedTaskId, taskTitle, taskDescription, taskPosition, taskDeadline, taskCategory, modalEditTask) => {
|
||||||
|
if(modalEditTask !== null) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (typeof taskDeadline != "string") {
|
if (typeof taskDeadline != "string") {
|
||||||
taskDeadline = null
|
taskDeadline = null
|
||||||
}
|
}
|
||||||
await updateTaskAPI(editedTaskId, taskTitle, taskDescription, taskPosition, taskDeadline, taskCategory);
|
await updateTaskAPI(editedTaskId, taskTitle, taskDescription, taskPosition, taskDeadline, taskCategory);
|
||||||
await loadBoardData();
|
|
||||||
if(modalEditTask !== null) {
|
if(modalEditTask !== null) {
|
||||||
|
await loadBoardData();
|
||||||
modalEditTask({}, null)();
|
modalEditTask({}, null)();
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ const KBBoard = () => {
|
|||||||
};
|
};
|
||||||
ws.onmessage = (event) => {
|
ws.onmessage = (event) => {
|
||||||
const message = JSON.parse(event.data);
|
const message = JSON.parse(event.data);
|
||||||
loadBoardData();
|
loadBoardData(true);
|
||||||
};
|
};
|
||||||
ws.onclose = () => console.log('WebSocket соединение закрыто');
|
ws.onclose = () => console.log('WebSocket соединение закрыто');
|
||||||
ws.onerror = (error) => console.error('Ошибка WebSocket:', error);
|
ws.onerror = (error) => console.error('Ошибка WebSocket:', error);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
|
import { useParams, useNavigate } from 'react-router-dom';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import Header from './Header';
|
import Header from './../Header';
|
||||||
|
import './../css/my.css';
|
||||||
|
|
||||||
const Name = () => {
|
const Name = () => {
|
||||||
const [user, setUser] = useState(null);
|
const [user, setUser] = useState(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user