-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add Comments for methods, classes and interface. #254
base: master
Are you sure you want to change the base?
Conversation
@@ -2,31 +2,39 @@ import React, {Component} from 'react'; | |||
|
|||
import {SDK} from '@ringcentral/sdk'; | |||
|
|||
// Utility function to get display name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a display name? Who's name? A user? A service? Or something else
const delay = () => new Promise(res => setTimeout(res, 0)); | ||
|
||
// Interface for the state of AuthGate component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need param description
export interface AuthGateState { | ||
isAuthorized: boolean; | ||
authorizing: boolean; | ||
authError: null | Error; | ||
} | ||
|
||
// Interface for the render props provided by AuthGate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need param description
export interface AuthGateRenderProps extends AuthGateState { | ||
loginUrl: (options: any) => string; | ||
parseRedirect: (search: string) => Promise<any>; | ||
logout: () => Promise<any>; | ||
} | ||
|
||
// Interface for the props of AuthGate component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need param description
export interface AuthGateProps { | ||
sdk: SDK; | ||
ensure?: boolean; | ||
children: (props: AuthGateRenderProps) => any; | ||
} | ||
|
||
// AuthGate component definition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does AuthGate do in general?
public before = () => this.mounted && this.setState({authorizing: true}); | ||
|
||
// Handler for error event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do in the handler?
public error = async e => this.updateState(e); | ||
|
||
// Handler for success event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do in the handler?
public success = async () => this.updateState(null); | ||
|
||
// Method to get login URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's in options?
@@ -107,6 +123,7 @@ export class AuthGate extends Component<AuthGateProps, AuthGateState> { | |||
} | |||
}; | |||
|
|||
// Method to update state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need more description of this method. This looks a bit like an unauth, which is confusing. Why is authorizing set to false?
@@ -120,6 +137,7 @@ export class AuthGate extends Component<AuthGateProps, AuthGateState> { | |||
}); | |||
}; | |||
|
|||
// Render method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not this one, but the one below if you expand the hidden code for Line 153 ~162.
There's a clear comment saying TODO Definition there. That's a very clear sign that we want to add its definition there.
No description provided.