-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show account balance, empty state for ai chat interface
- Loading branch information
Showing
4 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { useQuery } from "react-query" | ||
import { useAxios } from "./use-axios" | ||
|
||
interface AccountBalance { | ||
monthly_ai_budget_used_usd: number | ||
} | ||
|
||
export const useAccountBalance = () => { | ||
const axios = useAxios() | ||
|
||
return useQuery<AccountBalance, Error>( | ||
"accountBalance", | ||
async () => { | ||
const { data } = await axios.get("/accounts/get_account_balance") | ||
return data.account_balance | ||
}, | ||
{ | ||
refetchInterval: 60000, // Refetch every minute | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters