mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 04:16:24 -05:00
Creating a share modal and button which allows a user to send a notification event to all users.
This commit is contained in:
parent
4e85e2f3d7
commit
ac363ae0e2
9 changed files with 139 additions and 8 deletions
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue