mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 04:11:10 -05:00
Refactor
This commit is contained in:
@@ -20,11 +20,14 @@ const AppContent = () => {
|
|||||||
const message: ExtensionMessage = e.data
|
const message: ExtensionMessage = e.data
|
||||||
switch (message.type) {
|
switch (message.type) {
|
||||||
case "state":
|
case "state":
|
||||||
const hasKey =
|
let hasKey = false
|
||||||
message.state!.apiConfiguration?.apiKey !== undefined ||
|
const config = message.state?.apiConfiguration
|
||||||
message.state!.apiConfiguration?.openRouterApiKey !== undefined ||
|
if (config) {
|
||||||
message.state!.apiConfiguration?.awsAccessKey !== undefined ||
|
const { apiKey, openRouterApiKey, awsAccessKey, vertexProjectId } = config
|
||||||
message.state!.apiConfiguration?.vertexProjectId !== undefined
|
hasKey = [apiKey, openRouterApiKey, awsAccessKey, vertexProjectId].some((key) => key !== undefined)
|
||||||
|
} else {
|
||||||
|
hasKey = false
|
||||||
|
}
|
||||||
setShowWelcome(!hasKey)
|
setShowWelcome(!hasKey)
|
||||||
break
|
break
|
||||||
case "action":
|
case "action":
|
||||||
@@ -44,7 +47,6 @@ const AppContent = () => {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// (react-use takes care of not registering the same listener multiple times even if this callback is updated.)
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEvent("message", handleMessage)
|
useEvent("message", handleMessage)
|
||||||
|
|||||||
Reference in New Issue
Block a user