Skip to content

Commit

Permalink
feat: Support any type of token
Browse files Browse the repository at this point in the history
  • Loading branch information
trandaison committed Jun 20, 2024
1 parent ba7367a commit 13a7e75
Show file tree
Hide file tree
Showing 9 changed files with 1,527 additions and 1,904 deletions.
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@
"@nuxt/kit": "^3.8.2",
"@nuxtjs/i18n": "^8.2.0",
"@pinia/nuxt": "^0.5.1",
"dayjs": "^1.11.10",
"defu": "^6.1.3",
"jwt-decode": "^4.0.0",
"jwt-decode": "^3.1.2",
"lodash-es": "^4.17.21",
"ofetch": "^1.3.3",
"pathe": "^1.1.1",
Expand All @@ -56,8 +55,8 @@
"@types/node": "^20.10.3",
"changelogen": "^0.5.5",
"eslint": "^8.55.0",
"nuxt": "^3.11.2",
"vitepress": "1.0.0-rc.45",
"vitest": "^0.33.0"
"nuxt": "^3.12.2",
"vitepress": "^1.2.3",
"vitest": "^1.6.0"
}
}
}
12 changes: 10 additions & 2 deletions playground/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ const { $auth } = useNuxtApp();
const { user, loggedIn } = $auth;
const localeRoute = useLocaleRoute();
const fetched = ref(false);
const error = ref<any>(false);
function fetchUser() {
fetched.value = false;
$auth.fetchUser()
.then(() => {
alert('User fetched successfully!');
error.value = false;
})
.catch((err) => {
alert('Error fetching user, please check the console.');
error.value = err;
console.error(err);
})
.finally(() => {
fetched.value = true;
});
}
</script>
Expand All @@ -36,6 +43,7 @@ function fetchUser() {
Fetch user
</button>
</p>
<pre v-if="fetched">{{ JSON.stringify(error ? error : user, null, 2) }}</pre>
</div>
</template>

Expand Down
Loading

0 comments on commit 13a7e75

Please sign in to comment.