OPTIONS endpoint for CORS preflight
parent
3b77fb8062
commit
89bce70a60
|
@ -21,6 +21,9 @@ case "${REQUEST_METHOD}" in
|
||||||
# Delete peer
|
# Delete peer
|
||||||
'DELETE') "${LIB_DIR}/peer_del" "${HTTP_X_REAL_IP}" "${QUERY_STRING}";;
|
'DELETE') "${LIB_DIR}/peer_del" "${HTTP_X_REAL_IP}" "${QUERY_STRING}";;
|
||||||
|
|
||||||
|
# Needed for CORS preflight
|
||||||
|
'OPTIONS') "${LIB_DIR}/http_res" 200;;
|
||||||
|
|
||||||
# Bad request
|
# Bad request
|
||||||
*) printf 'Invalid HTTP verb' | "${LIB_DIR}/http_res" 405;;
|
*) printf 'Invalid HTTP verb' | "${LIB_DIR}/http_res" 405;;
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,6 @@ function PeerList() {
|
||||||
self.delPeer = async (peer) => {
|
self.delPeer = async (peer) => {
|
||||||
if (confirm(`Are you sure you want to delete ${peer.name}?`)) {
|
if (confirm(`Are you sure you want to delete ${peer.name}?`)) {
|
||||||
peer.isDeleting(true)
|
peer.isDeleting(true)
|
||||||
console.log(`Deleting ${peer.pubkey}`)
|
|
||||||
const url = `${API_URL}/?t=${self.token}&pubkey=${peer.pubkey}`
|
const url = `${API_URL}/?t=${self.token}&pubkey=${peer.pubkey}`
|
||||||
try {
|
try {
|
||||||
const res = await fetch(url, {method: 'DELETE'})
|
const res = await fetch(url, {method: 'DELETE'})
|
||||||
|
|
Loading…
Reference in New Issue