2020-12-28 17:08:08 +00:00
|
|
|
import { Role } from '@/api/admin/roles/getRoles';
|
|
|
|
import http from '@/api/http';
|
|
|
|
|
|
|
|
export default (name: string, description?: string): Promise<Role> => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
http.post('/api/application/roles', {
|
|
|
|
name, description,
|
|
|
|
})
|
2020-12-28 19:47:08 +00:00
|
|
|
.then(({ data }) => resolve(data.attributes))
|
2020-12-28 17:08:08 +00:00
|
|
|
.catch(reject);
|
|
|
|
});
|
|
|
|
};
|