Preselect dashboard domain in app installation
This commit is contained in:
@@ -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,
|
||||
};
|
||||
Reference in New Issue
Block a user