()
| 29 | ) => Promise<any>; |
| 30 | |
| 31 | export async function autoOpenUserApiKey() { |
| 32 | const { execute } = setUserApiKey(); |
| 33 | const { state, updateUserInfo } = useAppStateStore(); |
| 34 | if (state.userInfo?.apiKey) { |
| 35 | return { |
| 36 | apiKey: state.userInfo?.apiKey |
| 37 | }; |
| 38 | } |
| 39 | await execute({ |
| 40 | data: { |
| 41 | enable: true |
| 42 | }, |
| 43 | forceRequest: true, |
| 44 | errorAlert: true |
| 45 | }); |
| 46 | await updateUserInfo(); |
| 47 | return { |
| 48 | apiKey: state.userInfo?.apiKey |
| 49 | }; |
| 50 | } |
| 51 | |
| 52 | export async function getUserInfo() { |
| 53 | const { state } = useAppStateStore(); |
no test coverage detected