- useConnections composable wrapping all /api/connections endpoints - Connections page with suggestions, filters, and connection management - Pending connection count badge in sidebar navigation - peer-support.vue now redirects to /connections
32 lines
871 B
JavaScript
32 lines
871 B
JavaScript
export const useConnections = () => {
|
|
const getSuggestions = (params = {}) =>
|
|
$fetch('/api/connections/suggestions', { params })
|
|
|
|
const getMyConnections = () =>
|
|
$fetch('/api/connections')
|
|
|
|
const requestConnection = (recipientId) =>
|
|
$fetch('/api/connections', { method: 'POST', body: { recipientId } })
|
|
|
|
const confirmConnection = (id) =>
|
|
$fetch(`/api/connections/${id}/confirm`, { method: 'POST' })
|
|
|
|
const hideConnection = (id) =>
|
|
$fetch(`/api/connections/${id}/hide`, { method: 'POST' })
|
|
|
|
const withdrawConnection = (id) =>
|
|
$fetch(`/api/connections/${id}/withdraw`, { method: 'POST' })
|
|
|
|
const getPendingCount = () =>
|
|
$fetch('/api/connections/pending-count')
|
|
|
|
return {
|
|
getSuggestions,
|
|
getMyConnections,
|
|
requestConnection,
|
|
confirmConnection,
|
|
hideConnection,
|
|
withdrawConnection,
|
|
getPendingCount,
|
|
}
|
|
}
|