File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,20 +102,18 @@ export default function App() {
102102 } ) ;
103103 } ;
104104
105- // Send message to background script to run audit (background has access to tabs/scripting APIs)
105+ // The background owns the auth checks: it refuses on a known-dead session
106+ // and the run's own form fetch is a live check, either way opening the
107+ // login page — no need for a slow probe from here first.
106108 const handleRerunAudit = async ( ) => {
107109 setRunningAudit ( true ) ;
108- const stillLoggedIn = await refreshLoginState ( ) ;
109- setLoggedIn ( stillLoggedIn ) ;
110- if ( ! stillLoggedIn ) {
110+ try {
111+ const response = await sendRuntimeMessage ( { type : "RUN_NEW_AUDIT" } ) ;
112+ if ( response && ! response . success ) setRunningAudit ( false ) ;
113+ } catch ( error ) {
114+ console . error ( "Failed to run audit:" , error ) ;
111115 setRunningAudit ( false ) ;
112- handleLogin ( ) ;
113- return ;
114116 }
115- const response = await sendRuntimeMessage ( { type : "RUN_NEW_AUDIT" } ) ;
116- // Background refuses when the session is dead (it opens the login page
117- // instead) — don't leave the spinner running.
118- if ( response && ! response . success ) setRunningAudit ( false ) ;
119117 } ;
120118
121119 const handleLogin = ( ) => {
You can’t perform that action at this time.
0 commit comments