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

Frontend SDK: export AuthError & AuthResult #1154

Closed
bastienbeurier opened this issue Oct 20, 2023 · 0 comments · Fixed by #1169
Closed

Frontend SDK: export AuthError & AuthResult #1154

bastienbeurier opened this issue Oct 20, 2023 · 0 comments · Fixed by #1169
Assignees
Labels
enhancement New feature or request

Comments

@bastienbeurier
Copy link
Member

bastienbeurier commented Oct 20, 2023

As mentioned in a private thread, we shoud export types for the .auth call of the Frontend SDK for a successful result:

{ providerConfigKey: string; connectionId: string }

and error responses:

{ message: string; type: string }

The auth call would go from :

nango.auth(nangoId, organization, nangoParams)
.then((result: { providerConfigKey: string; connectionId: string }) => {
    // Handle success.
.catch((err: { message: string; type: string }) => {
    // Handle error.
});

to

nango.auth(nangoId, organization, nangoParams)
.then((result: AuthResult) => {
    // Handle success.
.catch((err:  AuthError) => {
    // Handle error.
});

The developer on the same thread complains that TS compilation complaints if he doesn't guard for AuthError. He suggests we should have AuthError extend Error.

@bastienbeurier bastienbeurier changed the title Frontend SDK: export AuthError Frontend SDK: export AuthError & AuthResult Oct 20, 2023
@bastienbeurier bastienbeurier added the enhancement New feature or request label Oct 20, 2023
@khaliqgant khaliqgant self-assigned this Oct 20, 2023
khaliqgant added a commit that referenced this issue Oct 23, 2023
khaliqgant added a commit that referenced this issue Oct 23, 2023
khaliqgant added a commit that referenced this issue Oct 23, 2023
* [gh-#1154] AuthError & AuthResult

* [gh-#1154] formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants