diff --git a/client/modules/User/actions.js b/client/modules/User/actions.js
index cfd2664a..f0708c3c 100644
--- a/client/modules/User/actions.js
+++ b/client/modules/User/actions.js
@@ -222,10 +222,10 @@ export function updateSettings(formValues) {
.catch(response => Promise.reject(new Error(response.data.error)));
}
-export function createApiKeySuccess(token) {
+export function createApiKeySuccess(user) {
return {
type: ActionTypes.API_KEY_CREATED,
- token
+ user
};
}
@@ -233,9 +233,7 @@ export function createApiKey(label) {
return dispatch =>
axios.post(`${ROOT_URL}/account/api-keys`, { label }, { withCredentials: true })
.then((response) => {
- const { token } = response.data;
- dispatch(createApiKeySuccess(token));
- return token;
+ dispatch(createApiKeySuccess(response.data));
})
.catch(response => Promise.reject(new Error(response.data.error)));
}
diff --git a/client/modules/User/components/APIKeyForm.jsx b/client/modules/User/components/APIKeyForm.jsx
index 3d8dcef6..17ea1542 100644
--- a/client/modules/User/components/APIKeyForm.jsx
+++ b/client/modules/User/components/APIKeyForm.jsx
@@ -1,5 +1,62 @@
import PropTypes from 'prop-types';
import React from 'react';
+import InlineSVG from 'react-inlinesvg';
+import format from 'date-fns/format';
+import distanceInWordsToNow from 'date-fns/distance_in_words_to_now';
+import orderBy from 'lodash/orderBy';
+
+const trashCan = require('../../../images/trash-can.svg');
+
+function NewTokenDisplay({ token }) {
+ return (
+ Make sure to copy your new personal access token now. You won’t be able to see it again!
Name | +Created on | +Last used | +Actions | +
---|---|---|---|
{v.label} | +{format(new Date(v.createdAt), 'MMM D, YYYY h:mm A')} | +{distanceInWordsToNow(new Date(v.lastUsedAt), { addSuffix: true })} | ++ + | +
+ |
+
You have no API keys
; } render() { - const { newToken } = this.state; - - const content = newToken ? - ( -Here is your new key. Copy it somewhere, you won't be able to see it later !
- - -{v.label} Created on: {v.createdAt} |
- Last used on: {v.lastUsedAt} |
- - |