@@ -2,12 +2,12 @@ import Seam from 'seamapi'
2
2
import { getCookie , setCookie } from '../utils'
3
3
4
4
export const useSeamClient = ( {
5
- publishedKey ,
5
+ publishableKey ,
6
6
endpoint,
7
7
userIdentifierKey,
8
8
clientSessionToken,
9
9
} : {
10
- publishedKey ?: string
10
+ publishableKey ?: string
11
11
endpoint : string
12
12
userIdentifierKey : string
13
13
clientSessionToken ?: string
@@ -31,10 +31,14 @@ export const useSeamClient = ({
31
31
// no need to use public key
32
32
// TODO: check if client access token is valid (not expired), if expired/invalid, get new one with the public key
33
33
return getSeam ( clientSessionTokenFromCookie )
34
- } else if ( publishedKey ?. startsWith ( 'seam_pk1' ) ) {
34
+ } else if ( publishableKey ?. startsWith ( 'seam_pk1' ) ) {
35
35
// public key, need to create a client access token and store it in cookie
36
36
; ( async ( ) => {
37
- const clientSessionTokenResponse = await Seam . getClientSessionToken ( { publishedKey, userIdentifierKey, endpoint } )
37
+ const clientSessionTokenResponse = await Seam . getClientSessionToken ( {
38
+ publishableKey,
39
+ userIdentifierKey,
40
+ endpoint,
41
+ } )
38
42
if ( clientSessionTokenResponse . ok === false || ! clientSessionTokenResponse [ 'client_session' ] ) {
39
43
throw new Error ( 'Could not get client access token' )
40
44
}
@@ -47,7 +51,7 @@ export const useSeamClient = ({
47
51
// TODO: improve: use devices are not loading probably due to async nature of this hook
48
52
} ) ( )
49
53
} else {
50
- throw new Error ( 'No publishedKey nor clientSessionToken provided or they are invalid' )
54
+ throw new Error ( 'No publishableKey nor clientSessionToken provided or they are invalid' )
51
55
return null as any
52
56
}
53
57
return null as any
0 commit comments