Skip to content

Commit

Permalink
fix: Set tokenRefresh and refresh as possibly undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
acasazza committed Nov 23, 2021
1 parent 811de64 commit cadd19c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions specs/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe('Sales Channel mode', () => {
expect(auth).toHaveProperty('refreshToken')
expect(auth).toHaveProperty('expires')
expect(auth).toHaveProperty('tokenType')
expect(auth.refreshToken).not.toBeDefined()
expect(typeof auth.accessToken).toBe('string')
expect(auth.tokenType).toEqual('bearer')
expect(auth.refreshToken).not.toBeDefined()
Expand All @@ -48,6 +49,7 @@ describe('Sales Channel mode', () => {
expect(auth).toHaveProperty('accessToken')
expect(auth).toHaveProperty('refresh')
expect(auth).toHaveProperty('refreshToken')
expect(auth.refreshToken).toBeDefined()
expect(auth).toHaveProperty('expires')
expect(auth).toHaveProperty('tokenType')
expect(auth.data).toHaveProperty('owner_id')
Expand Down
5 changes: 3 additions & 2 deletions src/typings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ type AuthData = TokenData & {
}

export type AuthReturnType = Promise<
| (Token & {
| ((Omit<Token, 'refreshToken' | 'refresh'> & {
data: AuthData
expires?: Date
})
}) &
Partial<Pick<Token, 'refreshToken' | 'refresh'>>)
| null
>

Expand Down

0 comments on commit cadd19c

Please sign in to comment.