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

Fixed Login Window #264

Merged
merged 3 commits into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdk/src/platform/Platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@
height = 600,
origin = window.location.origin,
property = Constants.authResponseProperty,
target = '_blank',
target = 'RingCentralLoginWindow',
}: LoginWindowOptions): Promise<LoginOptions> {
// clear check last timeout when user open loginWindow twice to avoid leak
this._clearLoginWindowCheckTimeout();
return new Promise((resolve, reject) => {

Check warning on line 365 in sdk/src/platform/Platform.ts

View workflow job for this annotation

GitHub Actions / Test (16.x)

Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed

Check warning on line 365 in sdk/src/platform/Platform.ts

View workflow job for this annotation

GitHub Actions / Test (16.x)

Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed
if (typeof window === 'undefined') {throw new Error('This method can be used only in browser');}

if (!url) {throw new Error('Missing mandatory URL parameter');}
Expand All @@ -378,7 +378,7 @@

const win = window.open(
url,
'_blank',
target,
target === '_blank'
? `scrollbars=yes, status=yes, width=${width}, height=${height}, left=${left}, top=${top}`
: '',
Expand Down Expand Up @@ -454,7 +454,7 @@
}
}

public async login({

Check warning on line 457 in sdk/src/platform/Platform.ts

View workflow job for this annotation

GitHub Actions / Test (16.x)

Refactor this function to reduce its Cognitive Complexity from 34 to the 15 allowed

Check warning on line 457 in sdk/src/platform/Platform.ts

View workflow job for this annotation

GitHub Actions / Test (16.x)

Refactor this function to reduce its Cognitive Complexity from 34 to the 15 allowed
username,
password,
extension = '',
Expand Down Expand Up @@ -574,7 +574,7 @@
return {tokenEndpoint, discoveryEndpoint};
}

private async _refresh(): Promise<Response> {

Check warning on line 577 in sdk/src/platform/Platform.ts

View workflow job for this annotation

GitHub Actions / Test (16.x)

Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed

Check warning on line 577 in sdk/src/platform/Platform.ts

View workflow job for this annotation

GitHub Actions / Test (16.x)

Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed
try {
this.emit(this.events.beforeRefresh);

Expand Down Expand Up @@ -717,12 +717,12 @@
return request;
}

public async sendRequest(request: Request, options: SendOptions = {}): Promise<Response> {

Check warning on line 720 in sdk/src/platform/Platform.ts

View workflow job for this annotation

GitHub Actions / Test (16.x)

Refactor this function to reduce its Cognitive Complexity from 21 to the 15 allowed

Check warning on line 720 in sdk/src/platform/Platform.ts

View workflow job for this annotation

GitHub Actions / Test (16.x)

Refactor this function to reduce its Cognitive Complexity from 21 to the 15 allowed
try {
request = await this.inflateRequest(request, options);
return await this._client.sendRequest(request);
} catch (e) {
let {retry, handleRateLimit} = options;

Check warning on line 725 in sdk/src/platform/Platform.ts

View workflow job for this annotation

GitHub Actions / Test (16.x)

'retry' is never reassigned. Use 'const' instead

Check warning on line 725 in sdk/src/platform/Platform.ts

View workflow job for this annotation

GitHub Actions / Test (16.x)

'retry' is never reassigned. Use 'const' instead

// Guard is for errors that come from polling
if (!e.response || retry) {throw e;}
Expand Down
Loading