Update underlying model representation for PATs

This commit is contained in:
Dane Everitt 2021-07-28 20:53:54 -07:00
parent d60e8a193b
commit 1a3451fb0d
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
12 changed files with 135 additions and 24002 deletions

View file

@ -3,15 +3,13 @@ import http from '@/api/http';
export interface ApiKey {
identifier: string;
description: string;
allowedIps: string[];
createdAt: Date | null;
lastUsedAt: Date | null;
}
export const rawDataToApiKey = (data: any): ApiKey => ({
identifier: data.identifier,
identifier: data.token_id,
description: data.description,
allowedIps: data.allowed_ips,
createdAt: data.created_at ? new Date(data.created_at) : null,
lastUsedAt: data.last_used_at ? new Date(data.last_used_at) : null,
});

View file

@ -30,7 +30,7 @@ export default ({ onKeyCreated }: { onKeyCreated: (key: ApiKey) => void }) => {
.then(({ secretToken, ...key }) => {
resetForm();
setSubmitting(false);
setApiKey(`${key.identifier}${secretToken}`);
setApiKey(secretToken);
onKeyCreated(key);
})
.catch(error => {