import { QueryClient } from 'react-query' ; import * as db from '../db' ; import * as api from '../api' ; export async function updateOwner ( queryClient , owner ) { const newOwner = await db . updateOwner ( { ... owner } ) ; await api . patchOwner ( { publicKey : owner . publicKey } ) ; queryClient . invalidateQueries ( 'owner' ) ; return newOwner ; } export async function commitSetupPublicKey ( queryClient , owner ) { const { setupPublicKey , ... newOwner } = owner ; return await updateOwner ( queryClient , { ... newOwner , publicKey : setupPublicKey , } ) ; }