import { Form, Input, SubmitButton } from '../components/form' import * as Yup from 'yup' import { Alert, InputGroup } from 'react-bootstrap' import { useMe } from '../components/me' import LayoutCenter from '../components/layout-center' import { useState } from 'react' import { gql, useMutation } from '@apollo/client' export const SettingsSchema = Yup.object({ tipDefault: Yup.number().typeError('must be a number').required('required') .positive('must be positive').integer('must be whole') }) export default function Settings () { const me = useMe() const [success, setSuccess] = useState() const [setSettings] = useMutation( gql` mutation setSettings($tipDefault: Int!) { setSettings(tipDefault: $tipDefault) }` ) return (

settings

{ await setSettings({ variables: { tipDefault: Number(tipDefault) } }) setSuccess('settings saved') }} > {success && setSuccess(undefined)} dismissible>{success}} sats} />
save
) }