File tree Expand file tree Collapse file tree
packages/workshop-frontend/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,6 +94,11 @@ export function useAuth(publicApi: RpcStub<PublicApi>) {
9494 }
9595
9696 const logout = ( ) => {
97+ if ( CF_ACCESS_MODE ) {
98+ window . location . assign ( '/cdn-cgi/access/logout' )
99+ return
100+ }
101+
97102 // Use functional updater to read current state (avoids stale closure).
98103 setAuthState ( prev => {
99104 if ( prev . authenticatedApi ) {
@@ -107,9 +112,7 @@ export function useAuth(publicApi: RpcStub<PublicApi>) {
107112 }
108113 } )
109114
110- if ( ! CF_ACCESS_MODE ) {
111- localStorage . removeItem ( 'authToken' )
112- }
115+ localStorage . removeItem ( 'authToken' )
113116 }
114117
115118 return {
@@ -118,4 +121,4 @@ export function useAuth(publicApi: RpcStub<PublicApi>) {
118121 logout,
119122 isAuthenticated : ! ! authState . authenticatedApi
120123 }
121- }
124+ }
You can’t perform that action at this time.
0 commit comments