2021-01-08 22:18:08 +00:00
|
|
|
import http from '@/api/http';
|
|
|
|
import { Role, rawDataToRole } from '@/api/admin/roles/getRoles';
|
|
|
|
|
2021-01-15 16:41:15 +00:00
|
|
|
export default (id: number, name: string, description: string | null, include: string[] = []): Promise<Role> => {
|
2021-01-08 22:18:08 +00:00
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
http.patch(`/api/application/roles/${id}`, {
|
|
|
|
name, description,
|
2021-01-15 16:41:15 +00:00
|
|
|
}, { params: { include: include.join(',') } })
|
2021-01-08 22:18:08 +00:00
|
|
|
.then(({ data }) => resolve(rawDataToRole(data)))
|
|
|
|
.catch(reject);
|
|
|
|
});
|
|
|
|
};
|