added user profile api

This commit is contained in:
ari committed 2022-08-29 12:51:24 -04:00
1 parent 95ac286b53
commit 416d88b965
7 files changed
+88 -11

No files matched your search

+6 -3
View File
@@ -2,8 +2,9 @@ import { AutomationData } from "types/automations";
import { makeAutomationAPI } from "./automations";
import { makeRemoteAPI } from "./base";
import { useAPIService } from "./core";
import { useMockAPI } from "./mock";
import { useAutoMockAPI, useProfileMockAPI } from "./mock";
import { useRef } from "react";
import { makeProfileAPI } from "./profile";
const locationPrefixWeb = window.location.pathname.match(/(\/.+\/)web/i);
const baseURL = new URL(
@@ -13,12 +14,14 @@ const baseURL = new URL(
);
export const wsURL = baseURL + "socket";
export const remoteAutoAPI = makeRemoteAPI(baseURL + "automations");
export const detailsAPI = makeRemoteAPI(baseURL + "details/");
export const useConnectedApiService = () =>
useAPIService(makeAutomationAPI(remoteAutoAPI));
useAPIService(makeAutomationAPI(remoteAutoAPI), makeProfileAPI(detailsAPI));
export const useMockApiService = (
initialAutos: AutomationData[],
returnErrors: boolean = false
) =>
useAPIService(
makeAutomationAPI(useMockAPI(initialAutos, useRef, returnErrors))
makeAutomationAPI(useAutoMockAPI(initialAutos, useRef, returnErrors)),
makeProfileAPI(useProfileMockAPI())
);