Skip to content

Commit

Permalink
fix(BcDataWrapper): only call /users/me for signed in users
Browse files Browse the repository at this point in the history
Api endpoints need `session_id` cookie. So only call the `api endpoint` when frontend knows the user is `signed in`.
  • Loading branch information
marcel-bitfly committed Nov 4, 2024
1 parent 4144088 commit 1e36ad1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions frontend/components/bc/DataWrapper.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
<script setup lang="ts">
// The DataWrapper is for loading the Data that used in the whole app.
// We can't load the data directly in the app.vue as this would conflict with some providers being initialized there.
const { getUser } = useUserStore()
const {
getUser,
isLoggedIn,
} = useUserStore()
const { tick } = useInterval(12)
const { refreshLatestState } = useLatestStateStore()
const {
loadAvailableNetworks, setCurrentNetwork,
loadAvailableNetworks,
setCurrentNetwork,
} = useNetworkStore()
await useAsyncData('latest_state', () => refreshLatestState(), {
immediate: true,
watch: [ tick ],
})
await useAsyncData('get_user', () => getUser())
if (isLoggedIn) {
await useAsyncData('get_user', () => getUser())
}
await useAsyncData('get-supported-networks', () => loadAvailableNetworks())
const { chainIdByDefault } = useRuntimeConfig().public
Expand Down

0 comments on commit 1e36ad1

Please sign in to comment.