Don't instantiate the AuthService at the top level of the module. (#5443)
I am working separating the initialization for the extension and cline-core and this is causing a circular dependency.
This commit is contained in:
1 parent
1cf62941cd
commit
51c4e0aceb
3 files changed
+14
-9
No files matched your search
@@ -2,8 +2,6 @@ import { Controller } from "../index"
|
||||
import { AuthService } from "@/services/auth/AuthService"
|
||||
import { EmptyRequest, String } from "@shared/proto/cline/common"
|
||||
|
||||
const authService = AuthService.getInstance()
|
||||
|
||||
/**
|
||||
* Handles the user clicking the login link in the UI.
|
||||
* Generates a secure nonce for state validation, stores it in secrets,
|
||||
@@ -13,5 +11,5 @@ const authService = AuthService.getInstance()
|
||||
* @returns The login URL as a string.
|
||||
*/
|
||||
export async function accountLoginClicked(_controller: Controller, _: EmptyRequest): Promise<String> {
|
||||
return await authService.createAuthRequest()
|
||||
return await AuthService.getInstance().createAuthRequest()
|
||||
}
|
||||
@@ -3,7 +3,6 @@ import { Empty } from "@shared/proto/cline/common"
|
||||
import type { EmptyRequest } from "@shared/proto/cline/common"
|
||||
import type { Controller } from "../index"
|
||||
|
||||
const authService = AuthService.getInstance()
|
||||
/**
|
||||
* Handles the account logout action
|
||||
* @param controller The controller instance
|
||||
@@ -12,6 +11,6 @@ const authService = AuthService.getInstance()
|
||||
*/
|
||||
export async function accountLogoutClicked(controller: Controller, _request: EmptyRequest): Promise<Empty> {
|
||||
await controller.handleSignOut()
|
||||
await authService.handleDeauth()
|
||||
await AuthService.getInstance().handleDeauth()
|
||||
return Empty.create({})
|
||||
}
|
||||
@@ -1,5 +1,13 @@
|
||||
import { AuthService } from "../../../services/auth/AuthService"
|
||||
import { AuthState, EmptyRequest } from "@/shared/proto/index.cline"
|
||||
import { AuthService } from "@services/auth/AuthService"
|
||||
import { Controller } from ".."
|
||||
import { StreamingResponseHandler } from "../grpc-handler"
|
||||
|
||||
const authService = AuthService.getInstance()
|
||||
export const subscribeToAuthStatusUpdate = authService.subscribeToAuthStatusUpdate.bind(authService)
|
||||
export const sendAuthStatusUpdateEvent = authService.sendAuthStatusUpdate.bind(authService)
|
||||
export async function subscribeToAuthStatusUpdate(
|
||||
controller: Controller,
|
||||
request: EmptyRequest,
|
||||
responseStream: StreamingResponseHandler<AuthState>,
|
||||
requestId?: string,
|
||||
): Promise<void> {
|
||||
return AuthService.getInstance().subscribeToAuthStatusUpdate(controller, request, responseStream, requestId)
|
||||
}
|
||||
Reference in new issue
Block a user