File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
- import type { FC } from "react" ;
1
+ import { useEffect , type FC } from "react" ;
2
2
import { Helmet } from "react-helmet-async" ;
3
3
import { useQuery } from "react-query" ;
4
4
import { Navigate , useLocation , useNavigate } from "react-router-dom" ;
@@ -24,10 +24,21 @@ export const LoginPage: FC = () => {
24
24
const redirectTo = retrieveRedirect ( location . search ) ;
25
25
const applicationName = getApplicationName ( ) ;
26
26
const navigate = useNavigate ( ) ;
27
-
28
27
const { metadata } = useEmbeddedMetadata ( ) ;
29
28
const buildInfoQuery = useQuery ( buildInfo ( metadata [ "build-info" ] ) ) ;
30
29
30
+ useEffect ( ( ) => {
31
+ if ( ! buildInfoQuery . data || isSignedIn ) {
32
+ // isSignedIn already tracks with window.href!
33
+ return ;
34
+ }
35
+ // This uses `navigator.sendBeacon`, so navigating away will not prevent it!
36
+ sendDeploymentEvent ( buildInfoQuery . data , {
37
+ type : "deployment_login" ,
38
+ user_id : user ?. id ,
39
+ } ) ;
40
+ } , [ isSignedIn , buildInfoQuery . data , user ?. id ] ) ;
41
+
31
42
if ( isSignedIn ) {
32
43
// If the redirect is going to a workspace application, and we
33
44
// are missing authentication, then we need to change the href location
You can’t perform that action at this time.
0 commit comments