<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import{b as d,e as s,y as i,x as a,a9 as h,o}from"./chunks/framework.Cj_yJIKf.js";const c=h("",22),g=s("a",{href:"#onerror"},[s("code",null,"onError")],-1),u=s("a",{href:"#onsuccess"},[s("code",null,"onSuccess")],-1),y=h("",4),f=s("p",null,"This function will fire if the mutation encounters an error and will be passed the error.",-1),m=s("h4",{id:"onmutate",tabindex:"-1"},[i("onMutate "),s("a",{class:"header-anchor",href:"#onmutate","aria-label":'Permalink to "onMutate"'},"​")],-1),D=s("ul",null,[s("li",null,"This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive"),s("li",null,"Useful to perform optimistic updates to a resource in hopes that the mutation succeeds"),s("li",null,[i("The value returned from this function will be passed to both the "),s("code",null,"onError"),i(" and "),s("code",null,"onSettled"),i(" functions in the event of a mutation failure and can be useful for rolling back optimistic updates.")])],-1),b=s("h4",{id:"onsuccess",tabindex:"-1"},[i("onSuccess "),s("a",{class:"header-anchor",href:"#onsuccess","aria-label":'Permalink to "onSuccess"'},"​")],-1),A=s("p",null,"This function will fire when the mutation is successful and will be passed the mutation's result.",-1),B=s("h4",{id:"onsettled",tabindex:"-1"},[i("onSettled "),s("a",{class:"header-anchor",href:"#onsettled","aria-label":'Permalink to "onSettled"'},"​")],-1),_=s("p",null,"This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error",-1),v=s("h4",{id:"queryclient",tabindex:"-1"},[i("queryClient "),s("a",{class:"header-anchor",href:"#queryclient","aria-label":'Permalink to "queryClient"'},"​")],-1),C=s("p",null,[s("code",null,"QueryClient")],-1),w=s("p",null,[i("Use this to use a custom "),s("code",null,"QueryClient"),i(". Otherwise, the one from the nearest context will be used.")],-1),E=s("h4",{id:"retry",tabindex:"-1"},[i("retry "),s("a",{class:"header-anchor",href:"#retry","aria-label":'Permalink to "retry"'},"​")],-1),x=h("",2),T=h("",10),q=s("a",{class:"header-anchor",href:"#mutate","aria-label":'Permalink to "{{mutate}}"'},"​",-1),S=s("p",null,"The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.",-1),P=s("h4",{id:"variables",tabindex:"-1"},[i("variables "),s("a",{class:"header-anchor",href:"#variables","aria-label":'Permalink to "variables"'},"​")],-1),F=["href"],I=s("h4",{id:"onsuccess-1",tabindex:"-1"},[i("onSuccess "),s("a",{class:"header-anchor",href:"#onsuccess-1","aria-label":'Permalink to "onSuccess"'},"​")],-1),V=s("p",null,"This function will fire when the mutation is successful and will be passed the mutation's result.",-1),N=s("h4",{id:"onerror-1",tabindex:"-1"},[i("onError "),s("a",{class:"header-anchor",href:"#onerror-1","aria-label":'Permalink to "onError"'},"​")],-1),R=s("p",null,"This function will fire if the mutation encounters an error and will be passed the error.",-1),M=s("h4",{id:"onsettled-1",tabindex:"-1"},[i("onSettled "),s("a",{class:"header-anchor",href:"#onsettled-1","aria-label":'Permalink to "onSettled"'},"​")],-1),Q=s("ul",null,[s("li",null,"This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error"),s("li",null,[i("If you make multiple requests, "),s("code",null,"onSuccess"),i(" will fire only after the latest call you've made.")])],-1),j=s("a",{class:"header-anchor",href:"#mutate-async","aria-label":'Permalink to "{{mutate}}Async"'},"​",-1),U=s("h3",{id:"data",tabindex:"-1"},[i("data "),s("a",{class:"header-anchor",href:"#data","aria-label":'Permalink to "data"'},"​")],-1),W=["href"],z=s("li",null,[i("Defaults to "),s("code",null,"undefined")],-1),O=s("li",null,"The last successfully resolved data for the mutation.",-1),Z=s("h3",{id:"error",tabindex:"-1"},[i("error "),s("a",{class:"header-anchor",href:"#error","aria-label":'Permalink to "error"'},"​")],-1),G=h("",5),K=h("",17),Y=s("li",null,[i("Defaults to "),s("code",null,"undefined"),i(".")],-1),$=s("h2",{id:"tanstack-query",tabindex:"-1"},[i("TanStack Query "),s("a",{class:"header-anchor",href:"#tanstack-query","aria-label":'Permalink to "TanStack Query"'},"​")],-1),J=s("button",{title:"Copy Code",class:"copy"},null,-1),L=s("span",{class:"lang"},"ts",-1),H=s("span",{class:"line"},[s("span",{style:{"--shiki-light":"#1E754F","--shiki-dark":"#4D9375"}},"import"),s("span",{style:{"--shiki-light":"#999999","--shiki-dark":"#666666"}}," {")],-1),X=s("span",{style:{"--shiki-light":"#1E754F","--shiki-dark":"#4D9375"}},"  type",-1),ss=s("span",{style:{"--shiki-light":"#999999","--shiki-dark":"#666666"}},",",-1),is=s("span",{style:{"--shiki-light":"#1E754F","--shiki-dark":"#4D9375"}},"  type",-1),as=s("span",{style:{"--shiki-light":"#999999","--shiki-dark":"#666666"}},",",-1),ts=s("span",{style:{"--shiki-light":"#1E754F","--shiki-dark":"#4D9375"}},"  type",-1),es=s("span",{style:{"--shiki-light":"#999999","--shiki-dark":"#666666"}},",",-1),ns=s("span",{style:{"--shiki-light":"#1E754F","--shiki-dark":"#4D9375"}},"  type",-1),ls=s("span",{style:{"--shiki-light":"#999999","--shiki-dark":"#666666"}},",",-1),hs=s("span",{style:{"--shiki-light":"#999999","--shiki-dark":"#666666"}},",",-1),ks=s("span",{style:{"--shiki-light":"#999999","--shiki-dark":"#666666"}},"}",-1),ps=s("span",{style:{"--shiki-light":"#1E754F","--shiki-dark":"#4D9375"}}," from",-1),rs=s("span",{style:{"--shiki-light":"#B5695977","--shiki-dark":"#C98A7D77"}}," '",-1),ds=s("span",{style:{"--shiki-light":"#B5695977","--shiki-dark":"#C98A7D77"}},"'",-1),os=s("h2",{id:"action",tabindex:"-1"},[i("Action "),s("a",{class:"header-anchor",href:"#action","aria-label":'Permalink to "Action"'},"​")],-1),cs=s("ul",null,[s("li",null,[s("a",{href:"/core/api/actions/switchAccount"},[s("code",null,"switchAccount")])])],-1),Ds=JSON.parse('{"title":"useSwitchAccount","description":"Composable for switching the current account.","frontmatter":{"title":"useSwitchAccount","description":"Composable for switching the current account."},"headers":[],"relativePath":"vue/api/composables/useSwitchAccount.md","filePath":"vue/api/composables/useSwitchAccount.md","lastUpdated":1742429166000}'),gs={name:"vue/api/composables/useSwitchAccount.md"},bs=Object.assign(gs,{setup(us){const p="wagmi",r="switchAccount",k="SwitchAccount",e="switchAccount",l="SwitchAccountData",n="SwitchAccountErrorType",t="SwitchAccountVariables";return(ys,fs)=&gt;(o(),d("div",null,[c,s("p",null,[i("If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever "),s("a",{href:"#mutate"},[s("code",null,a(e))]),i(" is available (e.g. "),g,i(", "),u,i(" functions).")]),y,s("p",null,[s("code",null,"((error: "+a(n)+", variables: "+a(t)+", context?: context | undefined) =&gt; Promise&lt;unknown&gt; | unknown) | undefined")]),f,m,s("p",null,[s("code",null,"((variables: "+a(t)+") =&gt; Promise&lt;context | void&gt; | context | void) | undefined")]),D,b,s("p",null,[s("code",null,"((data: "+a(l)+", variables: "+a(t)+", context?: context | undefined) =&gt; Promise&lt;unknown&gt; | unknown) | undefined")]),A,B,s("p",null,[s("code",null,"((data: "+a(l)+", error: "+a(n)+", variables: "+a(t)+", context?: context | undefined) =&gt; Promise&lt;unknown&gt; | unknown) | undefined")]),_,v,C,w,E,s("p",null,[s("code",null,"boolean | number | ((failureCount: number, error: "+a(n)+") =&gt; boolean) | undefined")]),x,s("p",null,[s("code",null,"number | ((retryAttempt: number, error: "+a(n)+") =&gt; number) | undefined")]),T,s("h3",{id:"mutate",tabindex:"-1"},[i(a(e)+" "),q]),s("p",null,[s("code",null,"(variables: "+a(t)+", { onSuccess, onSettled, onError }) =&gt; void")]),S,s("ul",null,[s("li",null,[P,s("p",null,[s("code",null,a(t))]),s("p",null,[i("The variables object to pass to the "),s("a",{href:`/core/api/actions/${e}#parameters`},[s("code",null,a(e))],8,F),i(" action.")])]),s("li",null,[I,s("p",null,[s("code",null,"(data: "+a(l)+", variables: "+a(t)+", context: TContext) =&gt; void")]),V]),s("li",null,[N,s("p",null,[s("code",null,"(error: "+a(n)+", variables: "+a(t)+", context: TContext | undefined) =&gt; void")]),R]),s("li",null,[M,s("p",null,[s("code",null,"(data: "+a(l)+" | undefined, error: "+a(n)+" | null, variables: "+a(t)+", context: TContext | undefined) =&gt; void")]),Q])]),s("h3",{id:"mutate-async",tabindex:"-1"},[i(a(e)+"Async "),j]),s("p",null,[s("code",null,"(variables: "+a(t)+", { onSuccess, onSettled, onError }) =&gt; Promise&lt;"+a(l)+"&gt;")]),s("p",null,[i("Similar to "),s("a",{href:"#mutate"},[s("code",null,a(e))]),i(" but returns a promise which can be awaited.")]),U,s("p",null,[s("code",null,a(l)+" | undefined")]),s("ul",null,[s("li",null,[s("a",{href:`/core/api/actions/${e}#return-type`},[s("code",null,a(e)),i(" return type")],8,W)]),z,O]),Z,s("p",null,[s("code",null,a(n)+" | null")]),G,s("p",null,[s("code",null,a(n)+" | null")]),K,s("p",null,[s("code",null,a(t)+" | undefined")]),s("ul",null,[s("li",null,[i("The variables object passed to "),s("a",{href:"#mutate"},[s("code",null,a(e))]),i(".")]),Y]),$,s("div",{class:"language-ts vp-adaptive-theme"},[J,L,s("pre",{class:"shiki shiki-themes vitesse-light vitesse-dark vp-code",style:{"--shiki-light":"#393a34","--shiki-dark":"#dbd7caee","--shiki-light-bg":"#ffffff","--shiki-dark-bg":"#121212"},tabindex:"0"},[s("code",null,[H,i(`
`),s("span",{class:"line"},[X,s("span",{style:{"--shiki-light":"#B07D48","--shiki-dark":"#BD976A"}}," "+a(k)+"Data"),ss]),i(`
`),s("span",{class:"line"},[is,s("span",{style:{"--shiki-light":"#B07D48","--shiki-dark":"#BD976A"}}," "+a(k)+"Variables"),as]),i(`
`),s("span",{class:"line"},[ts,s("span",{style:{"--shiki-light":"#B07D48","--shiki-dark":"#BD976A"}}," "+a(k)+"Mutate"),es]),i(`
`),s("span",{class:"line"},[ns,s("span",{style:{"--shiki-light":"#B07D48","--shiki-dark":"#BD976A"}}," "+a(k)+"MutateAsync"),ls]),i(`
`),s("span",{class:"line"},[s("span",{style:{"--shiki-light":"#B07D48","--shiki-dark":"#BD976A"}},"  "+a(r)+"MutationOptions"),hs]),i(`
`),s("span",{class:"line"},[ks,ps,rs,s("span",{style:{"--shiki-light":"#B56959","--shiki-dark":"#C98A7D"}},a(p)+"/query"),ds])])])]),os,cs]))}});export{Ds as __pageData,bs as default};
</pre></body></html>