Message from JavaScript discussions

October 2018

— You generally just check if status is 200-299 for OK

— 

Let me explain myself: I have an app and a file in a separate folder, protected via .htaccess. If I press a button to load the protected file, my server asks for username and password. If I cannot do the login I am unable to load the file... it is possible to detect with a script that I cannot load the protected file?

— Yes

— How?

— But the script may cause the login to pop up again

— Ajax / xhr / fetch

— 

fetch('http://example.com/protected/path')
.then(response =>
response.ok
? alert('Access granted')
: alert('Access denied'));

Message permanent page

— Thank you very much

— Telegraf/nodejs -> payments. https://gist.github.com/scaccogatto/022c83e7848abb2f02502612a605dc6b everything works fine until I try to make a payment (stripe TEST api). I press "PAY" on telegram UI, some kind of loading starts, then the bot writes: TypeError: Cannot convert undefined or null to object

Message permanent page

— Stack?

— Which line?

— 

at Function.keys (<anonymous>)
at bot.use (/home/gatto/Projects/momomo/host-bot/src/middlewares/defaultSession.js:12:16)
at execute (/home/gatto/Projects/momomo/host-bot/node_modules/telegraf/composer.js:313:13)
at Promise.resolve.handler (/home/gatto/Projects/momomo/host-bot/node_modules/telegraf/composer.js:313:49)
at execute (/home/gatto/Projects/momomo/host-bot/node_modules/telegraf/composer.js:313:13)
at Promise.resolve.handler (/home/gatto/Projects/momomo/host-bot/node_modules/telegraf/composer.js:313:49)
at /home/gatto/Projects/momomo/host-bot/node_modules/telegraf-session-redis/lib/session.js:70:16
at execute (/home/gatto/Projects/momomo/host-bot/node_modules/telegraf/composer.js:313:13)
at Promise.resolve.handler (/home/gatto/Projects/momomo/host-bot/node_modules/telegraf/composer.js:313:49)
at execute (/home/gatto/Projects/momomo/host-bot/node_modules/telegraf/composer.js:313:13)

Message permanent page