5.9.0: Статус Отклонено для желаний
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m20s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m20s
This commit is contained in:
@@ -78,6 +78,7 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
||||
if (onNavigate) {
|
||||
onNavigate('wishlist')
|
||||
}
|
||||
onClose?.()
|
||||
} catch (err) {
|
||||
console.error('Error completing wishlist:', err)
|
||||
setToastMessage({ text: err.message || 'Ошибка при завершении', type: 'error' })
|
||||
@@ -86,6 +87,34 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
||||
}
|
||||
}
|
||||
|
||||
const handleReject = async () => {
|
||||
if (!wishlistItem || !wishlistItem.unlocked) return
|
||||
|
||||
setIsCompleting(true)
|
||||
try {
|
||||
const response = await authFetch(`${API_URL}/${wishlistId}/reject`, {
|
||||
method: 'POST',
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Ошибка при отклонении')
|
||||
}
|
||||
|
||||
if (onRefresh) {
|
||||
onRefresh()
|
||||
}
|
||||
if (onNavigate) {
|
||||
onNavigate('wishlist')
|
||||
}
|
||||
onClose?.()
|
||||
} catch (err) {
|
||||
console.error('Error rejecting wishlist:', err)
|
||||
setToastMessage({ text: err.message || 'Ошибка при отклонении', type: 'error' })
|
||||
} finally {
|
||||
setIsCompleting(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleUncomplete = async () => {
|
||||
if (!wishlistItem || !wishlistItem.completed) return
|
||||
|
||||
@@ -103,6 +132,7 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
||||
onRefresh()
|
||||
}
|
||||
fetchWishlistDetail()
|
||||
onClose?.()
|
||||
} catch (err) {
|
||||
console.error('Error uncompleting wishlist:', err)
|
||||
setToastMessage({ text: err.message || 'Ошибка при возобновлении желания', type: 'error' })
|
||||
@@ -687,13 +717,22 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
||||
</button>
|
||||
) : (
|
||||
<>
|
||||
<button
|
||||
onClick={handleComplete}
|
||||
disabled={isCompleting}
|
||||
className="wishlist-detail-complete-button"
|
||||
>
|
||||
{isCompleting ? 'Завершение...' : 'Завершить'}
|
||||
</button>
|
||||
<div className="wishlist-detail-action-buttons">
|
||||
<button
|
||||
onClick={handleComplete}
|
||||
disabled={isCompleting}
|
||||
className="wishlist-detail-complete-button"
|
||||
>
|
||||
{isCompleting ? '...' : 'Завершить'}
|
||||
</button>
|
||||
<button
|
||||
onClick={handleReject}
|
||||
disabled={isCompleting}
|
||||
className="wishlist-detail-reject-button"
|
||||
>
|
||||
{isCompleting ? '...' : 'Отклонить'}
|
||||
</button>
|
||||
</div>
|
||||
<div style={{ position: 'relative', display: 'inline-block' }}>
|
||||
<button
|
||||
onClick={handleCreateTask}
|
||||
|
||||
Reference in New Issue
Block a user