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

fix: exports ApiError interface so can be used by third-party implementations #178

Merged
merged 1 commit into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
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
6 changes: 1 addition & 5 deletions src/GoTrueApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import { COOKIE_OPTIONS } from './lib/constants'
import { setCookie, deleteCookie } from './lib/cookies'
import { expiresAt } from './lib/helpers'

export interface ApiError {
message: string
status: number
}

import type { ApiError } from './lib/types'
export default class GoTrueApi {
protected url: string
protected headers: {
Expand Down
10 changes: 6 additions & 4 deletions src/GoTrueClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import GoTrueApi, { ApiError } from './GoTrueApi'
import GoTrueApi from './GoTrueApi'
import { isBrowser, getParameterByName, uuid } from './lib/helpers'
import { GOTRUE_URL, DEFAULT_HEADERS, STORAGE_KEY } from './lib/constants'
import {
import { polyfillGlobalThis } from './lib/polyfills'
import { Fetch } from './lib/fetch'

import type {
ApiError,
Session,
User,
UserAttributes,
Expand All @@ -12,8 +16,6 @@ import {
UserCredentials,
VerifyOTPParams,
} from './lib/types'
import { polyfillGlobalThis } from './lib/polyfills'
import { Fetch } from './lib/fetch'

polyfillGlobalThis() // Make "globalThis" available

Expand Down
5 changes: 5 additions & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export type AuthChangeEvent =
| 'USER_DELETED'
| 'PASSWORD_RECOVERY'

export interface ApiError {
message: string
status: number
}

export interface Session {
provider_token?: string | null
access_token: string
Expand Down