Skip to content

Commit

Permalink
Minor updates after writing PR description
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Jul 18, 2022
1 parent 52baee8 commit 966916d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/auth/src/authFactory.ts
Expand Up @@ -38,5 +38,6 @@ export function createAuthentication<
const useAuth = createUseAuth(AuthContext)
const AuthProvider = createAuthProvider(AuthContext, authImplementation)

// TODO: Do we really need to return AuthContext here?
return { AuthContext, AuthProvider, useAuth }
}
17 changes: 10 additions & 7 deletions packages/auth/src/authImplementations/netlify.ts
@@ -1,5 +1,7 @@
import type * as NetlifyIdentityNS from 'netlify-identity-widget'

import { isBrowser } from '@redwoodjs/prerender/browserUtils'

import { createAuthentication } from 'src/authFactory'
// TODO:
// In the future, when this is a separate package, we can import the full thing
Expand All @@ -10,15 +12,16 @@ import { createAuthentication } from 'src/authFactory'
import { AuthImplementation } from './AuthImplementation'

type NetlifyIdentity = typeof NetlifyIdentityNS
type User = NetlifyIdentityNS.User

export function createNetlifyAuth(netlifyIdentity: NetlifyIdentity) {
const authImplementation = createNetlifyAuthImplementation(netlifyIdentity)

isBrowser && netlifyIdentity.init()

return createAuthentication<
User,
User | null,
User | null,
NetlifyIdentityNS.User,
NetlifyIdentityNS.User | null,
NetlifyIdentityNS.User | null,
void,
null,
never,
Expand All @@ -31,9 +34,9 @@ export function createNetlifyAuth(netlifyIdentity: NetlifyIdentity) {
function createNetlifyAuthImplementation(
netlifyIdentity: NetlifyIdentity
): AuthImplementation<
User,
User | null,
User | null,
NetlifyIdentityNS.User,
NetlifyIdentityNS.User | null,
NetlifyIdentityNS.User | null,
void,
null,
never,
Expand Down

0 comments on commit 966916d

Please sign in to comment.