spike: proxy error on login [INS-4009] (#7546)

* fix: proxy error on login [INS-4009]

* add preferences button

* change data-testid for settings in auth authorize

* Update packages/insomnia/src/ui/routes/auth.authorize.tsx

Co-authored-by: Jack Kavanagh <jackkav@gmail.com>

* Update auth.authorize.tsx

* Update auth.authorize.tsx

---------

Co-authored-by: Jack Kavanagh <jackkav@gmail.com>
This commit is contained in:
Filipe Freire 2024-06-17 13:04:36 +01:00 committed by GitHub
parent 35f320e26b
commit fd8f12e408
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,6 +6,7 @@ import { invariant } from '../../utils/invariant';
import { SegmentEvent } from '../analytics';
import { getLoginUrl, submitAuthCode } from '../auth-session-provider';
import { Icon } from '../components/icon';
import { showSettingsModal } from '../components/modals/settings-modal';
import { Button } from '../components/themed-button';
export const action: ActionFunction = async ({
@ -16,7 +17,7 @@ export const action: ActionFunction = async ({
invariant(typeof data?.code === 'string', 'Expected code to be a string');
const error = await submitAuthCode(data.code);
if (error) {
const humanReadableError = error?.message === 'TypeError: Failed to fetch' ? 'Network failed, try again.' : error?.message;
const humanReadableError = error?.message === 'Failed to fetch' ? 'Network failed, please try again. If the problem persists, check your network and proxy settings.' : error?.message;
return {
errors: {
message: humanReadableError,
@ -152,6 +153,13 @@ const Authorize = () => {
<Icon icon="arrow-left" />
<span>Go Back</span>
</Button>
<Button
data-testid="settings-button-auth-authorize"
className="px-4 py-1 h-full flex items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] text-[--color-font] text-xs hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all"
onClick={showSettingsModal}
>
<Icon icon="gear" /> Preferences
</Button>
</div>
</div>
);