feat(ssh-keys): add ssh key endpoints and ui components

This commit is contained in:
Matthew Penner 2021-07-17 15:45:46 -06:00
parent 9d64c6751b
commit f9114e2de0
17 changed files with 375 additions and 7 deletions

View file

@ -0,0 +1,23 @@
import http from '@/api/http';
export interface SSHKey {
id: number;
name: string;
publicKey: string;
createdAt: Date;
}
export const rawDataToSSHKey = (data: any): SSHKey => ({
id: data.id,
name: data.name,
publicKey: data.public_key,
createdAt: new Date(data.created_at),
});
export default (): Promise<SSHKey[]> => {
return new Promise((resolve, reject) => {
http.get('/api/client/account/ssh')
.then(({ data }) => resolve((data.data || []).map((d: any) => rawDataToSSHKey(d.attributes))))
.catch(reject);
});
};