Skip to content

Commit

Permalink
Add generic Userinfo to createFusionAuth for vue sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelyons committed Jun 24, 2024
1 parent f56cdd1 commit 9d37bf5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ describe('createFusionAuth', () => {
});

it('Fetches userInfo', async () => {
const user = { given_name: 'JSON', family_name: 'Bourne' };
const user = {
given_name: 'JSON',
family_name: 'Bourne',
customTrait: 'additional info',
};
const mockUserInfoResponse = new Response(JSON.stringify(user), {
status: 200,
});
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-vue/src/createFusionAuth/createFusionAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export const createFusionAuth = (config: FusionAuthConfig): FusionAuth => {
const isGettingUserInfo = ref<boolean>(false);
const error = ref<Error | null>(null);

async function getUserInfo() {
async function getUserInfo<T>() {
isGettingUserInfo.value = true;
error.value = null;

try {
userInfo.value = await core.fetchUserInfo();
userInfo.value = await core.fetchUserInfo<T>();
return userInfo.value;
} catch (e) {
error.value = e as Error;
Expand Down

0 comments on commit 9d37bf5

Please sign in to comment.