Skip to content

Commit

Permalink
add preferences button
Browse files Browse the repository at this point in the history
  • Loading branch information
filfreire committed Jun 14, 2024
1 parent 0621a98 commit 2ac05d3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/insomnia/src/ui/routes/auth.authorize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ({
Expand All @@ -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 === 'Failed to fetch' ? 'Network failed, please try again. Note: if this happens many times, check if you have any Proxy configuration enabled on Insomnia settings and disable it.' : error?.message;
const humanReadableError = error?.message === 'Failed to fetch' ? 'Network failed, please try again. If this happens repeatedly, check if you have any Proxy enabled on Insomnia Preferences or on your device and try to disable it.' : error?.message;
return {
errors: {
message: humanReadableError,
Expand Down Expand Up @@ -152,6 +153,13 @@ const Authorize = () => {
<Icon icon="arrow-left" />
<span>Go Back</span>
</Button>
<Button
data-testid="settings-button"
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>
);
Expand Down

0 comments on commit 2ac05d3

Please sign in to comment.