diff --git a/nerdlets/github-about/main.js b/nerdlets/github-about/main.js index f9a58fe..1dd6f65 100644 --- a/nerdlets/github-about/main.js +++ b/nerdlets/github-about/main.js @@ -227,6 +227,7 @@ export default class GithubAbout extends React.PureComponent { } async _deleteUserToken() { + await this._deleteGithubUrl(); const mutation = { actionType: UserSecretsMutation.ACTION_TYPE.DELETE_SECRET, name: 'GH_TOKEN' @@ -237,6 +238,7 @@ export default class GithubAbout extends React.PureComponent { async _setRepo(repoUrl) { repoUrl = formatGithubUrl(repoUrl); + await this._deleteUserToken(); const { entityGuid } = this.props.nerdletUrlState; const mutation = { actionType: EntityStorageMutation.ACTION_TYPE.WRITE_DOCUMENT, diff --git a/nerdlets/github-about/setup.js b/nerdlets/github-about/setup.js index 87750b0..2c6f7b1 100644 --- a/nerdlets/github-about/setup.js +++ b/nerdlets/github-about/setup.js @@ -1,7 +1,17 @@ /* eslint-disable react/no-did-update-set-state */ import React from 'react'; import PropTypes from 'prop-types'; -import { TextField, Button, Stack, StackItem, Grid, GridItem } from 'nr1'; +import { + TextField, + Button, + Stack, + StackItem, + Grid, + GridItem, + Tooltip, + Badge, + Icon +} from 'nr1'; import isUrl from 'is-url'; const PUBLIC_GITHUB_API = 'https://api.github.com'; @@ -55,7 +65,12 @@ export default class Setup extends React.PureComponent { handleSetGithubUrl() { const { githubUrl } = this.state; - const { setGithubUrl, setActiveTab } = this.props; + const { + setGithubUrl, + setActiveTab, + deleteUserToken, + userToken + } = this.props; if (githubUrl === '') { return; } @@ -64,6 +79,10 @@ export default class Setup extends React.PureComponent { this.setState({ isValidUrl: false }); return; } + if (userToken) { + deleteUserToken(); + return; + } this.setState({ isValidUrl: true }); @@ -239,6 +258,16 @@ export default class Setup extends React.PureComponent { )} + + + + +