diff --git a/src/routes/LoginWithPersonalAccessToken.tsx b/src/routes/LoginWithPersonalAccessToken.tsx
index 46b85f927..938a8f8d0 100644
--- a/src/routes/LoginWithPersonalAccessToken.tsx
+++ b/src/routes/LoginWithPersonalAccessToken.tsx
@@ -120,17 +120,20 @@ export const LoginWithPersonalAccessToken: FC = () => {
);
};
- const login = useCallback(async (data: IValues) => {
- setIsValidToken(true);
- try {
- await loginWithPersonalAccessToken(
- data as LoginPersonalAccessTokenOptions,
- );
- navigate(-1);
- } catch (err) {
- setIsValidToken(false);
- }
- }, []);
+ const login = useCallback(
+ async (data: IValues) => {
+ setIsValidToken(true);
+ try {
+ await loginWithPersonalAccessToken(
+ data as LoginPersonalAccessTokenOptions,
+ );
+ navigate(-1);
+ } catch (err) {
+ setIsValidToken(false);
+ }
+ },
+ [loginWithPersonalAccessToken],
+ );
return (
diff --git a/src/utils/auth/utils.test.ts b/src/utils/auth/utils.test.ts
index f120fd49a..5648a4599 100644
--- a/src/utils/auth/utils.test.ts
+++ b/src/utils/auth/utils.test.ts
@@ -3,6 +3,7 @@ import type { AxiosPromise, AxiosResponse } from 'axios';
import { mockAuth, mockGitHubCloudAccount } from '../../__mocks__/state-mocks';
import type { Account, AuthState } from '../../types';
import * as apiRequests from '../api/request';
+import type { AuthMethod } from './types';
import * as auth from './utils';
import { getNewOAuthAppURL, getNewTokenURL } from './utils';
@@ -222,18 +223,27 @@ describe('utils/auth/utils.ts', () => {
method: 'GitHub App',
} as Account),
).toBe('https://github.com/settings/apps');
+
expect(
auth.getDeveloperSettingsURL({
hostname: 'github.com',
method: 'OAuth App',
} as Account),
).toBe('https://github.com/settings/developers');
+
expect(
auth.getDeveloperSettingsURL({
hostname: 'github.com',
method: 'Personal Access Token',
} as Account),
).toBe('https://github.com/settings/tokens');
+
+ expect(
+ auth.getDeveloperSettingsURL({
+ hostname: 'github.com',
+ method: 'unknown' as AuthMethod,
+ } as Account),
+ ).toBe('https://github.com/settings');
});
describe('getNewTokenURL', () => {
diff --git a/src/utils/auth/utils.ts b/src/utils/auth/utils.ts
index a6c3f2122..151b29c5f 100644
--- a/src/utils/auth/utils.ts
+++ b/src/utils/auth/utils.ts
@@ -53,7 +53,7 @@ export const authGitHub = (
authWindow.webContents.on(
'did-fail-load',
- (event, errorCode, errorDescription, validatedURL) => {
+ (_event, _errorCode, _errorDescription, validatedURL) => {
if (validatedURL.includes(authOptions.hostname)) {
authWindow.destroy();
reject(
@@ -151,6 +151,9 @@ export function getDeveloperSettingsURL(account: Account): string {
case 'Personal Access Token':
settingsURL.pathname = '/settings/tokens';
break;
+ default:
+ settingsURL.pathname = '/settings';
+ break;
}
return settingsURL.toString();
}
diff --git a/src/utils/theme.test.ts b/src/utils/theme.test.ts
index 0c54200c4..9018ac869 100644
--- a/src/utils/theme.test.ts
+++ b/src/utils/theme.test.ts
@@ -21,7 +21,7 @@ describe('utils/theme.ts', () => {
it("should use the system's mode - light", () => {
Object.defineProperty(window, 'matchMedia', {
writable: true,
- value: jest.fn().mockImplementation((query) => ({
+ value: jest.fn().mockImplementation((_query) => ({
matches: false,
})),
});
@@ -32,7 +32,7 @@ describe('utils/theme.ts', () => {
it("should use the system's mode - dark", () => {
Object.defineProperty(window, 'matchMedia', {
writable: true,
- value: jest.fn().mockImplementation((query) => ({
+ value: jest.fn().mockImplementation((_query) => ({
matches: true,
})),
});