added protobuf ts dependency
This commit is contained in:
parent
61b789b725
commit
c89ef8d48a
3 changed files with 116 additions and 12 deletions
|
|
@ -6,6 +6,8 @@ import { useUserAPI } from '../providers/pond/userAPI'
|
|||
import { useAuth0 } from '@auth0/auth0-react'
|
||||
import { or } from '../utils/types'
|
||||
import LoadingScreen from './LoadingScreen'
|
||||
import { pond } from "protobuf-ts/pond";
|
||||
|
||||
|
||||
export default function UserWrapper() {
|
||||
const [count, setCount] = useState(0)
|
||||
|
|
@ -13,17 +15,14 @@ export default function UserWrapper() {
|
|||
const userAPI = useUserAPI();
|
||||
const useAuth = useAuth0();
|
||||
const hasFetched = useRef(false);
|
||||
const [user, setUser] = useState<any | undefined>(undefined)
|
||||
const [user, setUser] = useState<pond.User | undefined>(undefined)
|
||||
|
||||
let user_id = or(useAuth.user?.sub, "")
|
||||
|
||||
const loadUser = useCallback(() => {
|
||||
// if (loading) return;
|
||||
if (hasFetched.current) return;
|
||||
setLoading(true)
|
||||
// console.log("send")
|
||||
userAPI.getUser(user_id).then(resp => {
|
||||
// console.log(resp)
|
||||
setUser(resp)
|
||||
}).finally(() => {
|
||||
setLoading(false)
|
||||
|
|
@ -57,7 +56,7 @@ export default function UserWrapper() {
|
|||
count is {count}
|
||||
</button>
|
||||
<p>
|
||||
The new Adaptive App
|
||||
Hello, {user.settings?.name}!
|
||||
</p>
|
||||
</div><p className="read-the-docs">
|
||||
Coming soon
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue