Re-enable debugbar, add table to ServersContainer.tsx

This commit is contained in:
Matthew Penner 2021-01-05 09:17:44 -07:00
parent ed73f6a020
commit 8f1a5bf0ab
15 changed files with 446 additions and 82 deletions

View file

@ -1,5 +1,4 @@
import http from '@/api/http';
import { rawDataToAdminRole } from '@/api/transformers';
import http, { FractalResponseData } from '@/api/http';
export interface Role {
id: number;
@ -7,10 +6,16 @@ export interface Role {
description: string | null;
}
export const rawDataToRole = ({ attributes }: FractalResponseData): Role => ({
id: attributes.id,
name: attributes.name,
description: attributes.description,
});
export default (): Promise<Role[]> => {
return new Promise((resolve, reject) => {
http.get('/api/application/roles')
.then(({ data }) => resolve((data.data || []).map(rawDataToAdminRole)))
.then(({ data }) => resolve((data.data || []).map(rawDataToRole)))
.catch(reject);
});
};