add extra logging to simplefin setup

This commit is contained in:
Robert Dyer
2026-02-28 12:18:31 -06:00
committed by GitHub
parent f18c6d1e1c
commit a5c9c0fd6f
+8
View File
@@ -16,6 +16,7 @@ const getCredentials = async () => {
const response = await fetch(url, { method: 'post' });
const api_url = await response.text();
try {
const rest = api_url.split('//', 2)[1];
const auth = rest.split('@', 1)[0];
const username = auth.split(':')[0];
@@ -26,6 +27,10 @@ const getCredentials = async () => {
fs.writeFileSync(cache + '/simplefin.credentials', data);
console.log('SimpleFIN credentials:', data);
return data;
} catch (err) {
console.log('Invalid SimpleFIN setup response:', api_url);
return undefined;
}
};
const loadCredentials = () => {
@@ -41,6 +46,9 @@ const getSimplefinBalances = async () => {
let credentials = loadCredentials();
if (!credentials) {
credentials = await getCredentials();
if (!credentials) {
return undefined;
}
}
const username = credentials.split(':')[0];
const pw = credentials.split(':')[1];