Add applink dialog in apps view
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
|
||||
import { ROLES } from '../constants.js';
|
||||
import { fetcher } from 'pankow';
|
||||
|
||||
function create(origin, accessToken) {
|
||||
return {
|
||||
name: 'ProfileModel',
|
||||
async get() {
|
||||
let error, result;
|
||||
try {
|
||||
result = await fetcher.get(`${origin}/api/v1/profile`, { access_token: accessToken });
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
if (error || result.status !== 200) {
|
||||
console.error('Failed to get profile.', error || result.status);
|
||||
return [];
|
||||
}
|
||||
|
||||
result.body.isAtLeastAdmin = [ ROLES.OWNER, ROLES.ADMIN ].indexOf(result.body.role) !== -1;
|
||||
|
||||
return result.body;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default {
|
||||
create,
|
||||
};
|
||||
Reference in New Issue
Block a user