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

refactor: Minimize duplicated line #44

Open
wants to merge 1 commit into
base: typescript
Choose a base branch
from
Open
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
5 changes: 2 additions & 3 deletions src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ export default class Auth {
// Add a hidden date property to the returned object.
// Used mostly to calculate the expiration date for tokens.
Object.defineProperty(data, 'expiresAt', { value: Date.parse(response.headers.get('date')) + 3600 * 1000 });
// Remove redundant property
delete data.kind;
return data;
});
}
Expand Down Expand Up @@ -422,7 +424,6 @@ export default class Auth {
*/
async fetchProvidersForEmail(email) {
const response = await this.api('createAuthUri', { identifier: email, continueUri: location.href });
delete response.kind;
return response as ProvidersForEmail;
}

Expand All @@ -436,7 +437,6 @@ export default class Auth {

const userData = (await this.api('lookup', { idToken: tokenManager.idToken })).users[0];

delete userData.kind;
userData.tokenManager = tokenManager;

await this.setState(userData);
Expand Down Expand Up @@ -465,7 +465,6 @@ export default class Auth {
updatedData.tokenManager = this.user.tokenManager;
}

delete updatedData.kind;
delete updatedData.idToken;
delete updatedData.refreshToken;

Expand Down