Creating a share modal and button which allows a user to send a notification event to all users.

This commit is contained in:
Roland 2023-04-10 13:15:34 -06:00
parent 4e85e2f3d7
commit ac363ae0e2
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
9 changed files with 139 additions and 8 deletions

View file

@ -782,4 +782,15 @@ export async function fetchFile(path) {
} else {
console.error('Unable to fetch file dict! See client logs.');
}
}
}
export async function sendNotification(message, url) {
const body = {message, url};
const response = await apiPost(`${API_URI}/notify`, body);
if (response.status === 201) {
toast({type: 'success', title: 'Shared', description: 'Your share was sent', time: 2000});
} else {
toast({type: 'error', title: 'Error', description: 'Your share failed to send!', time: 5000});
console.error('Failed to share');
}
}