diff --git a/src/utils/auth/utils.ts b/src/utils/auth/utils.ts index 6ff171faa..fec3e572d 100644 --- a/src/utils/auth/utils.ts +++ b/src/utils/auth/utils.ts @@ -17,9 +17,9 @@ import { Constants } from '../constants'; import { getPlatformFromHostname } from '../helpers'; import type { AuthMethod, AuthResponse, AuthTokenResponse } from './types'; -export const authGitHub = ( +export function authGitHub( authOptions = Constants.DEFAULT_AUTH_OPTIONS, -): Promise => { +): Promise { return new Promise((resolve, reject) => { // Build the OAuth consent page URL const authWindow = new BrowserWindow({ @@ -83,12 +83,12 @@ export const authGitHub = ( handleCallback(url as Link); }); }); -}; +} -export const getUserData = async ( +export async function getUserData( token: Token, hostname: Hostname, -): Promise => { +): Promise { const response: UserDetails = (await getAuthenticatedUser(hostname, token)) .data; @@ -97,12 +97,12 @@ export const getUserData = async ( login: response.login, name: response.name, }; -}; +} -export const getToken = async ( +export async function getToken( authCode: AuthCode, authOptions = Constants.DEFAULT_AUTH_OPTIONS, -): Promise => { +): Promise { const url = `https://${authOptions.hostname}/login/oauth/access_token` as Link; const data = { @@ -116,7 +116,7 @@ export const getToken = async ( hostname: authOptions.hostname, token: response.data.access_token, }; -}; +} export function addAccount( auth: AuthState, diff --git a/src/utils/notifications.ts b/src/utils/notifications.ts index a957e5e8e..d65f06067 100644 --- a/src/utils/notifications.ts +++ b/src/utils/notifications.ts @@ -11,11 +11,11 @@ import { openNotification } from './links'; import { isWindows } from './platform'; import { getGitifySubjectDetails } from './subject'; -export const setTrayIconColor = (notifications: AccountNotifications[]) => { +export function setTrayIconColor(notifications: AccountNotifications[]) { const allNotificationsCount = getNotificationCount(notifications); updateTrayIcon(allNotificationsCount); -}; +} export function getNotificationCount(notifications: AccountNotifications[]) { return notifications.reduce( diff --git a/src/utils/remove-notification.ts b/src/utils/remove-notification.ts index 01e0180b5..84734f425 100644 --- a/src/utils/remove-notification.ts +++ b/src/utils/remove-notification.ts @@ -2,11 +2,11 @@ import type { AccountNotifications, SettingsState } from '../types'; import type { Notification } from '../typesGitHub'; import { getAccountUUID } from './auth/utils'; -export const removeNotification = ( +export function removeNotification( settings: SettingsState, notification: Notification, notifications: AccountNotifications[], -): AccountNotifications[] => { +): AccountNotifications[] { if (settings.delayNotificationState) { return notifications; } @@ -31,4 +31,4 @@ export const removeNotification = ( } return notifications; -}; +} diff --git a/src/utils/remove-notifications.ts b/src/utils/remove-notifications.ts index b7d602cff..ee819ebf3 100644 --- a/src/utils/remove-notifications.ts +++ b/src/utils/remove-notifications.ts @@ -2,10 +2,10 @@ import type { AccountNotifications } from '../types'; import type { Notification } from '../typesGitHub'; import { getAccountUUID } from './auth/utils'; -export const removeNotifications = ( +export function removeNotifications( notification: Notification, notifications: AccountNotifications[], -): AccountNotifications[] => { +): AccountNotifications[] { const repoSlug = notification.repository.full_name; const accountIndex = notifications.findIndex( @@ -26,4 +26,4 @@ export const removeNotifications = ( } return notifications; -}; +} diff --git a/src/utils/theme.ts b/src/utils/theme.ts index abb3ac222..25a261f0d 100644 --- a/src/utils/theme.ts +++ b/src/utils/theme.ts @@ -8,15 +8,15 @@ export function getTheme(): Theme { return Theme.LIGHT; } -export const setLightMode = () => { +export function setLightMode() { document.querySelector('html').classList.remove('dark'); -}; +} -export const setDarkMode = () => { +export function setDarkMode() { document.querySelector('html').classList.add('dark'); -}; +} -export const setTheme = (mode?: Theme) => { +export function setTheme(mode?: Theme) { switch (mode) { case Theme.LIGHT: setLightMode(); @@ -33,4 +33,4 @@ export const setTheme = (mode?: Theme) => { setLightMode(); } } -}; +}