fix: fix netlify funcs status codes

This commit is contained in:
MTG2000
2022-06-02 14:45:39 +03:00
parent 5d902b66c3
commit ec3bbb27e8
2 changed files with 5 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ async function generateAuthUrl() {
async function login(tag, k1, sig, key) {
if (tag !== 'login') {
return {
statusCode: 400,
body: JSON.stringify({ status: 'ERROR', reason: 'Not a login request' })
}
}
@@ -26,6 +27,7 @@ async function login(tag, k1, sig, key) {
await LnurlService.verifySig(sig, k1, key)
} catch (error) {
return {
statusCode: 400,
body: JSON.stringify({ status: 'ERROR', reason: 'Invalid Signature' })
}
}
@@ -71,6 +73,7 @@ async function login(tag, k1, sig, key) {
return {
statusCode: 200,
'headers': {
'Set-Cookie': authCookie,
'Cache-Control': 'no-cache',
@@ -81,6 +84,7 @@ async function login(tag, k1, sig, key) {
}
} catch (error) {
return {
statusCode: 200,
body: JSON.stringify({ status: 'ERROR', reason: 'Unexpected error happened, please try again' })
}

View File

@@ -9,6 +9,7 @@ exports.handler = async (event, context) => {
maxAge: -1,
})
return {
statusCode: 200,
body: JSON.stringify({
status: 'OK',
}),