mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-05-02 16:09:50 -04:00
Merge branch 'main' of github.com:myfatemi04/wheelshare-frontend into main
This commit is contained in:
commit
f28024c49b
|
@ -8,21 +8,23 @@ export default function Notification({
|
||||||
}: {
|
}: {
|
||||||
notification: INotification;
|
notification: INotification;
|
||||||
}) {
|
}) {
|
||||||
|
const carpoolId = notification.carpool.id;
|
||||||
|
|
||||||
const acceptReq = useCallback(() => {
|
const acceptReq = useCallback(() => {
|
||||||
acceptRequest(notification.user.id);
|
acceptRequest(carpoolId, notification.user.id);
|
||||||
}, [notification.user.id]);
|
}, [carpoolId, notification.user.id]);
|
||||||
|
|
||||||
const rejectReq = useCallback(() => {
|
const rejectReq = useCallback(() => {
|
||||||
denyRequest(notification.user.id);
|
denyRequest(carpoolId, notification.user.id);
|
||||||
}, [notification.user.id]);
|
}, [carpoolId, notification.user.id]);
|
||||||
|
|
||||||
const acceptInv = useCallback(() => {
|
const acceptInv = useCallback(() => {
|
||||||
acceptInvite(notification.user.id);
|
acceptInvite(carpoolId, notification.user.id);
|
||||||
}, [notification.user.id]);
|
}, [carpoolId, notification.user.id]);
|
||||||
|
|
||||||
const rejectInv = useCallback(() => {
|
const rejectInv = useCallback(() => {
|
||||||
denyInvite(notification.user.id);
|
denyInvite(carpoolId, notification.user.id);
|
||||||
}, [notification.user.id]);
|
}, [carpoolId, notification.user.id]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="notification">
|
<div className="notification">
|
||||||
|
|
|
@ -132,20 +132,20 @@ export async function getNotifications() {
|
||||||
return await get('/users/@me/received_requests_and_invites');
|
return await get('/users/@me/received_requests_and_invites');
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function acceptRequest(userId: number) {
|
export async function acceptRequest(carpoolId: number, userId: number) {
|
||||||
return await post('/carpools/:id/accept_request', { userId });
|
return await post(`/carpools/${carpoolId}/accept_request`, { userId });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function acceptInvite(userId: number) {
|
export async function acceptInvite(carpoolId: number, userId: number) {
|
||||||
return await post('/carpools/:id/accept_invite', { userId });
|
return await post(`/carpools/${carpoolId}/accept_invite`, { userId });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function denyRequest(userId: number) {
|
export async function denyRequest(carpoolId: number, userId: number) {
|
||||||
return await post('/carpools/:id/deny_request', { userId });
|
return await post(`/carpools/${carpoolId}/deny_request`, { userId });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function denyInvite(userId: number) {
|
export async function denyInvite(carpoolId: number, userId: number) {
|
||||||
return await post('/carpools/:id/deny_invite', { userId });
|
return await post(`/carpools/${carpoolId}/deny_invite`, { userId });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getMe() {
|
export async function getMe() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user