mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-05-09 11:42:57 +00:00
feat: send message to user if file upload isn't completed and they try to close the tab
This commit is contained in:
parent
ba5b5fbfe3
commit
d004015f03
@ -94,6 +94,9 @@ export async function post (url, content = '', overwrite = false, onupload) {
|
||||
request.upload.onprogress = onupload
|
||||
}
|
||||
|
||||
// Send a message to user before closing the tab during file upload
|
||||
window.onbeforeunload = () => "Files are being uploaded."
|
||||
|
||||
request.onload = () => {
|
||||
if (request.status === 200) {
|
||||
resolve(request.responseText)
|
||||
@ -109,7 +112,8 @@ export async function post (url, content = '', overwrite = false, onupload) {
|
||||
}
|
||||
|
||||
request.send(content)
|
||||
})
|
||||
// Upload is done no more message before closing the tab
|
||||
}).finally(() => { window.onbeforeunload = null })
|
||||
}
|
||||
|
||||
function moveCopy (items, copy = false) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user