new CloudStateClient
CloudStateClient holds all of your client configuration, and initializes the hooks synchronously.

Usage

1
const myAppId = "<REPLACEME>";
2
3
const config = {
4
onAuthSuccess: () => {
5
// do something after the user has logged in
6
// example: redirect to the dashboard
7
// window.location.replace("/dashboard");
8
},
9
onAuthRequest: () => {
10
// do something when the user needs to be logged in
11
// example: redirect to the login page
12
// window.location.replace("/login");
13
}
14
}
15
16
export const client = new CloudStateClient(myAppId, config);
Copied!

Parameters

onAuthSuccess

Called after a user had successfully logged into the application.

onAuthRequest

Called if a valid authenticated session doesn't exist for a user, when the user tries to either get or set the state. (For example, via useCloudState or useCloudQuery)
Copy link