mirror of
https://github.com/Kong/insomnia.git
synced 2026-04-21 06:37:36 -04:00
fix: Replace sign out button with prompt button for better user confirmation [INS-5877] (#8841)
* refactor: replace sign out button with prompt button for better user confirmation * refactor: replace sign out button with prompt button for improved user experience
This commit is contained in:
@@ -4,7 +4,7 @@ import { useFetcher } from 'react-router';
|
||||
|
||||
import type { GitCredentials } from '../../../models/git-credentials';
|
||||
import type { GitRepository } from '../../../models/git-repository';
|
||||
import { showAlert } from '../modals';
|
||||
import { PromptButton } from '../base/prompt-button';
|
||||
import { GitHubRepositorySelect } from './github-repository-select';
|
||||
|
||||
interface Props {
|
||||
@@ -100,22 +100,14 @@ const GitHubRepositoryForm = ({ uri, credentials, onSubmit }: GitHubRepositoryFo
|
||||
<span className="text-sm text-[--hl]">{credentials.author.email || 'Signed in'}</span>
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
onPress={() => {
|
||||
showAlert({
|
||||
title: 'Sign out of GitHub',
|
||||
message:
|
||||
'Are you sure you want to sign out? You will need to re-authenticate with GitHub to use this feature.',
|
||||
okLabel: 'Sign out',
|
||||
onConfirm: () => {
|
||||
signOutFetcher.submit({}, { action: '/git-credentials/github/sign-out', method: 'POST' });
|
||||
},
|
||||
});
|
||||
<PromptButton
|
||||
confirmMessage="Confirm"
|
||||
onClick={() => {
|
||||
signOutFetcher.submit({}, { action: '/git-credentials/github/sign-out', method: 'POST' });
|
||||
}}
|
||||
>
|
||||
Sign out
|
||||
</Button>
|
||||
Disconnect
|
||||
</PromptButton>
|
||||
</div>
|
||||
<GitHubRepositorySelect uri={uri} token={credentials.token} />
|
||||
{error && (
|
||||
|
||||
@@ -4,8 +4,8 @@ import { useFetcher } from 'react-router';
|
||||
|
||||
import type { GitCredentials } from '../../../models/git-credentials';
|
||||
import type { GitRepository } from '../../../models/git-repository';
|
||||
import { PromptButton } from '../base/prompt-button';
|
||||
import { Icon } from '../icon';
|
||||
import { showAlert } from '../modals';
|
||||
|
||||
interface Props {
|
||||
uri?: string;
|
||||
@@ -98,22 +98,13 @@ const GitLabRepositoryForm = ({ uri, credentials, onSubmit }: GitLabRepositoryFo
|
||||
<span className="text-sm text-[--hl]">{credentials.author.email || 'Signed in'}</span>
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
onPress={() => {
|
||||
showAlert({
|
||||
title: 'Sign out of GitLab',
|
||||
message:
|
||||
'Are you sure you want to sign out? You will need to re-authenticate with GitLab to use this feature.',
|
||||
okLabel: 'Sign out',
|
||||
onConfirm: () => {
|
||||
signOutFetcher.submit({}, { action: '/git-credentials/gitlab/sign-out', method: 'POST' });
|
||||
},
|
||||
});
|
||||
<PromptButton
|
||||
onClick={() => {
|
||||
signOutFetcher.submit({}, { action: '/git-credentials/gitlab/sign-out', method: 'POST' });
|
||||
}}
|
||||
>
|
||||
Sign out
|
||||
</Button>
|
||||
Disconnect
|
||||
</PromptButton>
|
||||
</div>
|
||||
<TextField autoFocus name="uri" className="flex w-full flex-col gap-1 px-0.5" isRequired>
|
||||
<Label className="text-start text-sm font-semibold">Git URI (https, including .git suffix)</Label>
|
||||
|
||||
Reference in New Issue
Block a user