Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature-request : Add asynchronous on setUserWithHashAuth method #119

Open
Thomas-TF1 opened this issue Jun 17, 2024 · 1 comment
Open

Comments

@Thomas-TF1
Copy link

Hello,

I have an issue with setUserWithHashAuth method. It seems that this method is not promisable.
I am quering shouldUserStatusBeCollected method further in my app so I would like to synchronize it setUserWithHashAuth method.

Is it possible to make it promisable?

@pmerlet-at-didomi
Copy link
Contributor

Hello, currently the method is not promisable, but the user synchronization operation itself is asynchronous. You have to listen to SYNC_READY and SYNC_ERROR events to be notified when synchronization is complete:

Didomi.addEventListener(DidomiEventType.SYNC_READY, async(data: SyncReadyEvent) => {
    console.log('Sync is ready');
    // Resolve promise
});
Didomi.addEventListener(DidomiEventType.SYNC_ERROR, async(data: string) => {
    console.log('Sync error, reason: ' + data);
    // Resolve or fail promise
});

Didomi.setUserWithHashAuth(...);

Changing it in the SDK would be complicated, as it would be a breaking change for clients already using this method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants