/ src / lib / utils / launch-claim-orcid.ts
launch-claim-orcid.ts
 1  import walletStore from '$lib/stores/wallet/wallet.store';
 2  import modal from '$lib/stores/modal';
 3  import ClaimOrcidStepper from '$lib/flows/claim-orcid-flow/claim-orcid-stepper.svelte';
 4  import { goto } from '$app/navigation';
 5  import { get } from 'svelte/store';
 6  import buildUrl from './build-url';
 7  
 8  export default function launchClaimOrcid(orcidId?: string) {
 9    if (get(walletStore).connected) {
10      modal.show(ClaimOrcidStepper, undefined, {
11        skipWalletConnect: true,
12        orcidId,
13      });
14      return;
15    }
16  
17    const claimOrcidPath = '/app/claim-orcid';
18    if (orcidId) {
19      goto(buildUrl(claimOrcidPath, { orcidId }));
20      return;
21    }
22  
23    goto(claimOrcidPath);
24  }