Skip to content

Commit

Permalink
fix(oauth/battlenet): use oauthconfig type
Browse files Browse the repository at this point in the history
  • Loading branch information
sifferhans committed Nov 15, 2023
1 parent 9232265 commit 542c587
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/runtime/server/lib/oauth/battledotnet.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type { H3Event, H3Error } from 'h3'
import type { H3Event } from 'h3'
import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from 'h3'
import { ofetch } from 'ofetch'
import { withQuery, parsePath } from 'ufo'
import { defu } from 'defu'
import { useRuntimeConfig } from '#imports'
import { randomUUID } from 'crypto'
import type { OAuthConfig } from '~/src/runtime/types/auth0'

export interface OAuthBattledotnetConfig {
/**
Expand Down Expand Up @@ -43,13 +44,7 @@ export interface OAuthBattledotnetConfig {
tokenURL?: string
}

interface OAuthConfig {
config?: OAuthBattledotnetConfig
onSuccess: (event: H3Event, result: { user: any, tokens: any }) => Promise<void> | void
onError?: (event: H3Event, error: H3Error) => Promise<void> | void
}

export function battledotnetEventHandler({ config, onSuccess, onError }: OAuthConfig) {
export function battledotnetEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthBattledotnetConfig>) {
return eventHandler(async (event: H3Event) => {

// @ts-ignore
Expand Down

0 comments on commit 542c587

Please sign in to comment.