2020-10-04 20:25:58 +00:00
|
|
|
import http from '@/api/http';
|
2020-12-28 19:47:08 +00:00
|
|
|
import { rawDataToAdminRole } from '@/api/transformers';
|
2020-10-04 20:25:58 +00:00
|
|
|
|
|
|
|
export interface Role {
|
2020-12-28 17:08:08 +00:00
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
description: string | null;
|
2020-10-04 20:25:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default (): Promise<Role[]> => {
|
|
|
|
return new Promise((resolve, reject) => {
|
2020-12-28 04:57:31 +00:00
|
|
|
http.get('/api/application/roles')
|
2020-12-28 19:47:08 +00:00
|
|
|
.then(({ data }) => resolve((data.data || []).map(rawDataToAdminRole)))
|
2020-10-04 20:25:58 +00:00
|
|
|
.catch(reject);
|
|
|
|
});
|
|
|
|
};
|