delinting web app

This commit is contained in:
balzack 2024-10-26 17:54:07 -07:00
parent 55b1f98263
commit f3b839f96b
7 changed files with 17 additions and 14 deletions

View File

@ -27,10 +27,11 @@ export function Access() {
await actions.adminLogin()
}
otpClose()
} catch (err: any) {
console.log(err.message)
if (err.message === '405' || err.message === '403' || err.message === '429') {
if (err.message === '429') {
} catch (err) {
const { message } = err as { message: string }
console.log(message)
if (message === '405' || message === '403' || message === '429') {
if (message === '429') {
setDisabled(true)
} else {
setDisabled(false)

View File

@ -1,6 +1,6 @@
import { Text } from '@mantine/core'
import React from 'react'
import { useContacts } from './useContacts.hook'
import { UnstyledButton, ActionIcon, TextInput, Button } from '@mantine/core'
import { ActionIcon, TextInput, Button } from '@mantine/core'
import { IconSearch, IconUserPlus, IconSortAscending, IconSortDescending, IconMessage2, IconPhone } from '@tabler/icons-react'
import classes from './Contacts.module.css'
import { Card } from '../card/Card'

View File

@ -2,7 +2,7 @@ import { useState, useContext, useEffect } from 'react'
import { AppContext } from '../context/AppContext'
import { DisplayContext } from '../context/DisplayContext'
import { ContextType } from '../context/ContextType'
import { Card, Channel } from 'databag-client-sdk'
import { Card } from 'databag-client-sdk'
export function useContacts() {
const app = useContext(AppContext) as ContextType

View File

@ -1,5 +1,5 @@
import { useState, useEffect, useRef } from 'react'
import { DatabagSDK, Params, Session } from 'databag-client-sdk'
import { DatabagSDK, Session } from 'databag-client-sdk'
import { SessionStore } from '../SessionStore'
import { WebCrypto } from '../WebCrypto'

View File

@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'
import React, { useState } from 'react'
import { useProfile } from './useProfile.hook'
import classes from './Profile.module.css'
import { modals } from '@mantine/modals'
@ -18,7 +18,7 @@ import {
IconCancel,
IconDeviceFloppy,
} from '@tabler/icons-react'
import { Text, Image, ActionIcon, Button } from '@mantine/core'
import { Text, Image, ActionIcon } from '@mantine/core'
export type ProfileParams = {
guid: string

View File

@ -1,7 +1,8 @@
import React from 'react'
import { useRegistry } from './useRegistry.hook'
import { TextInput } from '@mantine/core'
import classes from './Registry.module.css'
import { IconX, IconArrowLeft, IconServer, IconUser } from '@tabler/icons-react'
import { IconX, IconServer, IconUser } from '@tabler/icons-react'
import { Card } from '../card/Card'
import { ProfileParams } from '../profile/Profile'

View File

@ -169,10 +169,11 @@ export function Settings({ showLogout }: { showLogout: boolean }) {
try {
await actions.confirmMFA()
mfaClose()
} catch (err: any) {
if (err.message === '401') {
} catch (err) {
const { message } = err as { message: string }
if (message === '401') {
setAuthMessage(state.strings.mfaError)
} else if (err.message === '429') {
} else if (message === '429') {
setAuthMessage(state.strings.mfaDisabled)
} else {
setAuthMessage(`${state.strings.error}: ${state.strings.tryAgain}`)