mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
refactor(api): log more data
This commit is contained in:
parent
375a901ca0
commit
8b4f752103
|
@ -2,7 +2,7 @@ const strava = require('../shared/strava.js');
|
|||
const withings = require('../shared/withings.js');
|
||||
|
||||
module.exports = async function (context, req) {
|
||||
context.log('JavaScript HTTP trigger function processed a request.');
|
||||
context.log('Auth function processed a request');
|
||||
// strava example:
|
||||
// https://www.strava.com/oauth/authorize?client_id=76033&response_type=code&redirect_uri=https://ohmyposh.dev/api/auth&approval_prompt=force&scope=read,activity:read&state=strava
|
||||
const code = (req.query.code || req.query._code || (req.body && req.body.code));
|
||||
|
@ -19,6 +19,8 @@ module.exports = async function (context, req) {
|
|||
return;
|
||||
}
|
||||
|
||||
context.log(`Processing the ${segment} code`);
|
||||
|
||||
switch (segment) {
|
||||
case "strava":
|
||||
tokens = await strava.getToken(code);
|
||||
|
|
|
@ -2,7 +2,7 @@ const strava = require('../shared/strava.js');
|
|||
const withings = require('../shared/withings.js');
|
||||
|
||||
module.exports = async function (context, req) {
|
||||
context.log('JavaScript HTTP trigger function processed a request.');
|
||||
context.log('Refresh function processed a request');
|
||||
// strava example:
|
||||
// https://ohmyposh.dev/api/refresh?segment=strava&token=<refresh_token>
|
||||
|
||||
|
@ -16,6 +16,7 @@ module.exports = async function (context, req) {
|
|||
return;
|
||||
}
|
||||
|
||||
context.log(`Refreshing the ${segment} token`);
|
||||
let body = null;
|
||||
switch (segment) {
|
||||
case "strava":
|
||||
|
@ -25,8 +26,9 @@ module.exports = async function (context, req) {
|
|||
body = await withings.refreshToken(refresh_token);
|
||||
break;
|
||||
default:
|
||||
context.log(`Unknown segment: ${segment}`);
|
||||
context.res = {
|
||||
body: "unknown segment",
|
||||
body: "Unknown segment",
|
||||
status: 400
|
||||
};
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue