@luxfi/core 4.4.13 → 4.4.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { useEffect } from 'react'
4
4
  import { useAuth } from '@hanzo/auth/service'
5
+ import { getCookie } from 'cookies-next'
5
6
 
6
7
  const AuthListener = () => {
7
8
  const auth = useAuth()
@@ -13,10 +14,11 @@ const AuthListener = () => {
13
14
  })
14
15
  .then(response => response.json())
15
16
  .then((data: any) => {
17
+ const token = getCookie('auth-token')
16
18
  console.log(data)
17
- if (!!data.token) {
18
-
19
- auth.loginWithCustomToken(data.token)
19
+ console.log(token)
20
+ if (!!token) {
21
+ auth.loginWithCustomToken(token)
20
22
  }
21
23
  })
22
24
  }, [auth])
@@ -11,6 +11,7 @@ import { LoginPanel as Login } from '@hanzo/auth/components'
11
11
  import { Logo } from '..'
12
12
  import LuxLogo from '../icons/lux-logo'
13
13
  import { legal } from '../../site-def/footer'
14
+ import { useRouter } from 'next/navigation'
14
15
 
15
16
  const LoginPanel: React.FC<{
16
17
  close: () => void
@@ -25,13 +26,19 @@ const LoginPanel: React.FC<{
25
26
  className='',
26
27
  reviews
27
28
  }) => {
29
+ const router = useRouter()
30
+
28
31
  const termsOfServiceUrl = legal.find(({title}) => title === 'Terms and Conditions')?.href || ''
29
32
  const privacyPolicyUrl = legal.find(({title}) => title === 'Privacy Policy')?.href || ''
30
33
 
31
34
  const onLogin = (token: string) => {
32
35
  setCookie('auth-token', token, {
36
+ sameSite: 'none',
37
+ secure: true,
33
38
  expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30), // 30 days
34
39
  })
40
+
41
+ redirectUrl && router.push(redirectUrl)
35
42
  }
36
43
 
37
44
  return (<>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxfi/core",
3
- "version": "4.4.13",
3
+ "version": "4.4.15",
4
4
  "description": "Library that contains shared UI primitives, support for a common design system, and other boilerplate support.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",