Preselect dashboard domain in app installation

This commit is contained in:
Johannes Zellner
2025-01-07 12:00:31 +01:00
parent 12d9e6b618
commit a887fc8153
2 changed files with 32 additions and 2 deletions
+27
View File
@@ -0,0 +1,27 @@
import { fetcher } from 'pankow';
function create(origin, accessToken) {
return {
name: 'DashboardModel',
async getConfig() {
let error, result;
try {
result = await fetcher.get(`${origin}/api/v1/dashboard/config`, { access_token: accessToken });
} catch (e) {
error = e;
}
if (error || result.status !== 200) {
console.error('Failed to get dashboard config.', error || result.status);
return {};
}
return result.body;
},
};
}
export default {
create,
};