mirror of
https://github.com/balzack/databag.git
synced 2025-04-24 10:35:23 +00:00
delinting web app
This commit is contained in:
parent
8e08342314
commit
b7d5ae9b4c
@ -44,7 +44,7 @@ export function Access() {
|
||||
await actions.adminLogin()
|
||||
}
|
||||
otpClose()
|
||||
} catch (err: any) {
|
||||
} catch (err: {message: string}) {
|
||||
console.log(err.message)
|
||||
if (
|
||||
err.message === '405' ||
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { useState, useEffect, useRef, useContext } from 'react'
|
||||
import { useState, useEffect, useRef } from 'react'
|
||||
import { DatabagSDK, Session } from 'databag-client-sdk'
|
||||
import { SessionStore } from '../SessionStore'
|
||||
import { WebCrypto } from '../WebCrypto'
|
||||
import { ContextType } from './ContextType'
|
||||
|
||||
export function useAppContext() {
|
||||
const sdk = useRef(new DatabagSDK(new WebCrypto()))
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useState } from 'react'
|
||||
import React from 'react'
|
||||
import classes from './Identity.module.css'
|
||||
import { useIdentity } from './useIdentity.hook'
|
||||
import { Text, Image, Menu, Switch } from '@mantine/core'
|
||||
@ -18,7 +18,6 @@ export function Identity({
|
||||
contacts: () => void
|
||||
}) {
|
||||
const { state, actions } = useIdentity()
|
||||
const [all, setAll] = useState(false)
|
||||
|
||||
const logout = () =>
|
||||
modals.openConfirmModal({
|
||||
@ -63,7 +62,7 @@ export function Identity({
|
||||
<Menu.Item onClick={settings} leftSection={<IconSettings />}>
|
||||
{state.strings.settings}
|
||||
</Menu.Item>
|
||||
<Menu.Item leftSection={<IconAddressBook />}>
|
||||
<Menu.Item onClick={contacts} leftSection={<IconAddressBook />}>
|
||||
{state.strings.contacts}
|
||||
</Menu.Item>
|
||||
<Menu.Item onClick={logout} leftSection={<IconLogout />}>
|
||||
|
@ -1,6 +1,5 @@
|
||||
import React, { useState, useContext } from 'react'
|
||||
import { Text, Drawer, Button } from '@mantine/core'
|
||||
import { AppContext } from '../context/AppContext'
|
||||
import { Drawer } from '@mantine/core'
|
||||
import { DisplayContext } from '../context/DisplayContext'
|
||||
import { ContextType } from '../context/ContextType'
|
||||
import classes from './Session.module.css'
|
||||
@ -15,7 +14,6 @@ import { useDisclosure } from '@mantine/hooks'
|
||||
|
||||
export function Session() {
|
||||
const [tab, setTab] = useState('channels')
|
||||
const app = useContext(AppContext) as ContextType
|
||||
const display = useContext(DisplayContext) as ContextType
|
||||
const [settings, { open: openSettings, close: closeSettings }] =
|
||||
useDisclosure(false)
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useSettings } from './useSettings.hook'
|
||||
import React, { useSettings } from './useSettings.hook'
|
||||
import {
|
||||
Modal,
|
||||
Textarea,
|
||||
@ -16,7 +16,6 @@ import {
|
||||
} from '@mantine/core'
|
||||
import classes from './Settings.module.css'
|
||||
import {
|
||||
IconKey,
|
||||
IconLock,
|
||||
IconUser,
|
||||
IconClock,
|
||||
@ -215,7 +214,7 @@ export function Settings({ showLogout }: { showLogout: boolean }) {
|
||||
|
||||
const selectImage = (target: HTMLInputElement) => {
|
||||
if (target.files) {
|
||||
var reader = new FileReader()
|
||||
const reader = new FileReader()
|
||||
reader.onload = () => {
|
||||
if (typeof reader.result === 'string') {
|
||||
actions.setEditImage(reader.result)
|
||||
@ -340,7 +339,6 @@ export function Settings({ showLogout }: { showLogout: boolean }) {
|
||||
|
||||
const onCropComplete = useCallback((crop: Area) => {
|
||||
actions.setEditImageCrop(crop)
|
||||
// eslint-disable-next-line
|
||||
}, [])
|
||||
|
||||
return (
|
||||
|
@ -3,9 +3,6 @@ import { AppContext } from '../context/AppContext'
|
||||
import { DisplayContext } from '../context/DisplayContext'
|
||||
import { ContextType } from '../context/ContextType'
|
||||
import {
|
||||
Session,
|
||||
Settings,
|
||||
Identity,
|
||||
type Profile,
|
||||
type Config,
|
||||
} from 'databag-client-sdk'
|
||||
@ -295,7 +292,7 @@ export function useSettings() {
|
||||
const { identity } = getSession()
|
||||
const processImg = () => {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
let img = new Image()
|
||||
const img = new Image()
|
||||
img.onload = () => {
|
||||
try {
|
||||
const canvas = document.createElement('canvas')
|
||||
|
Loading…
x
Reference in New Issue
Block a user