misc_pterodactyl-panel/resources/scripts/api/admin/roles/createRole.ts

13 lines
405 B
TypeScript
Raw Normal View History

import http from '@/api/http';
2021-01-06 23:38:39 +00:00
import { Role, rawDataToRole } from '@/api/admin/roles/getRoles';
export default (name: string, description?: string): Promise<Role> => {
return new Promise((resolve, reject) => {
http.post('/api/application/roles', {
name, description,
})
2021-01-06 23:38:39 +00:00
.then(({ data }) => resolve(rawDataToRole(data)))
.catch(reject);
});
};