feat(ssh-keys): add ssh key endpoints and ui components
This commit is contained in:
parent
9d64c6751b
commit
f9114e2de0
17 changed files with 375 additions and 7 deletions
23
resources/scripts/api/account/ssh/getSSHKeys.ts
Normal file
23
resources/scripts/api/account/ssh/getSSHKeys.ts
Normal 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);
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue