diff options
author | vnugent <public@vaughnnugent.com> | 2023-11-22 15:07:08 -0500 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2023-11-22 15:07:08 -0500 |
commit | e272adcc3f32e31fe7668551453b8e34bc823c3e (patch) | |
tree | 680c695184ddbc27227578afa9f169d98a69f55a /extension/src/features/server-api/index.ts | |
parent | 2ba94602a87c87b47f566745bdab40ce75e0e879 (diff) |
feature and internal api polish
Diffstat (limited to 'extension/src/features/server-api/index.ts')
-rw-r--r-- | extension/src/features/server-api/index.ts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/extension/src/features/server-api/index.ts b/extension/src/features/server-api/index.ts index 6637aaa..fd8e65e 100644 --- a/extension/src/features/server-api/index.ts +++ b/extension/src/features/server-api/index.ts @@ -14,12 +14,11 @@ // along with this program. If not, see <https://www.gnu.org/licenses/>. -import { computed } from "vue" +import { Ref } from "vue" import { get } from '@vueuse/core' import { type WebMessage, type UserProfile } from "@vnuge/vnlib.browser" import { initEndponts } from "./endpoints" import { cloneDeep } from "lodash" -import { type AppSettings } from "../settings" import type { EncryptionRequest, NostrEvent, NostrPubKey, NostrRelay } from "../types" export enum Endpoints { @@ -48,12 +47,12 @@ export interface ExecRequestHandler{ (id: Endpoints.UpdateProfile, profile: UserProfile):Promise<string> } -export const useServerApi = (settings: AppSettings): { execRequest: ExecRequestHandler } => { - const { registerEndpoint, execRequest } = initEndponts() +export interface ServerApi{ + execRequest: ExecRequestHandler +} - //ref to nostr endpoint url - const nostrUrl = computed(() => settings.currentConfig.value.nostrEndpoint || '/nostr'); - const accUrl = computed(() => settings.currentConfig.value.accountBasePath || '/account'); +export const useServerApi = (nostrUrl: Ref<string>, accUrl: Ref<string>): ServerApi => { + const { registerEndpoint, execRequest } = initEndponts() registerEndpoint({ id: Endpoints.GetKeys, |