Created
August 27, 2025 13:16
-
-
Save mikekreeki/3a551477656dc8477812f1ac753aba7e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: ((areaId, token) => { | |
var options = { | |
method: 'POST', | |
headers: { | |
Authorization: 'Bearer ' + token, | |
Accept: 'application/json', | |
'Content-Type': 'application/json', | |
}, | |
body: JSON.stringify({ | |
task: { | |
area_id: areaId, | |
name: document.title, | |
note: '<' + window.location.href + '>', | |
} | |
}) | |
}; | |
var onSuccess = (response) => { | |
if (response.status !== 201) { | |
response.json().then((data) => { | |
window.alert('Error saving web page to Lunatask: ' + JSON.stringify(data)); | |
}) | |
} else { | |
window.alert('Saved to Lunatask!'); | |
} | |
}; | |
var onError = (error) => { | |
window.alert('Error saving web page to Lunatask: ' + error.message); | |
}; | |
fetch('https://api.lunatask.app/v1/tasks', options).then(onSuccess).catch(onError); | |
})('insert-area-id-here', 'insert-api-token-here'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment