Skip to content

Commit

Permalink
use createInviteRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanharikr committed Nov 22, 2024
1 parent 197aabc commit b2de5ec
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 27 deletions.
25 changes: 7 additions & 18 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createAuthRequest, fetchToken, parseToken } from '@hellocoop/helper-browser';
import { createAuthRequest, fetchToken, parseToken, createInviteRequest } from '@hellocoop/helper-browser';

const CONFIG = {
client_id: 'app_GreenfieldFitnessDemoApp_s9z',
Expand Down Expand Up @@ -213,23 +213,12 @@ async function invite() {
inviteBtn.disabled = true;

const { sub } = JSON.parse(sessionStorage.getItem('profile'));

// TBD Uncomment and use this to create invite request URL when npm package is updated
// const { url } = createInviteRequest({
// inviter: sub,
// client_id: CONFIG.client_id,
// initiate_login_uri: window.location.origin,
// return_uri: window.location.origin
// })
// window.location.href = url.href;

const url = new URL('https://wallet.hello.coop/invite');

url.searchParams.append('inviter', sub);
url.searchParams.append('client_id', CONFIG.client_id);
url.searchParams.append('initiate_login_uri', window.location.origin);
url.searchParams.append('return_uri', window.location.origin);

const { url } = createInviteRequest({
inviter: sub,
client_id: CONFIG.client_id,
initiate_login_uri: window.location.origin,
return_uri: window.location.origin
})
window.location.href = url.href;
}

Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"vite": "^5.4.10"
},
"dependencies": {
"@hellocoop/helper-browser": "^2.3.0"
"@hellocoop/helper-browser": "^2.4.0"
}
}

0 comments on commit b2de5ec

Please sign in to comment.