2024-11-27 01:02:05 +08:00
|
|
|
import { CapabilityService } from "core/capability";
|
2024-11-30 02:15:46 +08:00
|
|
|
import { HttpClient } from "core/http";
|
2024-11-27 01:02:05 +08:00
|
|
|
import { RouteManager } from "core/route";
|
2024-11-18 01:09:28 +08:00
|
|
|
import { createServiceContext } from "hooks/createServiceContext";
|
2024-11-17 17:17:40 +08:00
|
|
|
import { ReactNode } from "react";
|
2024-11-14 23:01:21 +08:00
|
|
|
|
2024-11-18 01:09:28 +08:00
|
|
|
export const { CapabilityProvider, useCapability } = createServiceContext(
|
2024-11-22 13:13:04 +08:00
|
|
|
"Capability",
|
|
|
|
() => CapabilityService.getInstance(),
|
2024-11-17 17:17:40 +08:00
|
|
|
);
|
2024-11-14 23:01:21 +08:00
|
|
|
|
2024-11-27 01:02:05 +08:00
|
|
|
export const { RouteProvider, useRoute } = createServiceContext("Route", () =>
|
|
|
|
RouteManager.getInstance(),
|
2024-11-17 17:17:40 +08:00
|
|
|
);
|
2024-11-14 23:01:21 +08:00
|
|
|
|
2024-11-30 02:15:46 +08:00
|
|
|
export const { HttpProvider, useHttp } = createServiceContext("Http", () =>
|
|
|
|
HttpClient.getInstance(),
|
2024-11-18 01:09:28 +08:00
|
|
|
);
|
|
|
|
|
2024-11-27 01:02:05 +08:00
|
|
|
export const BaseProvider = ({ children }: { children: ReactNode }) => (
|
2024-11-30 02:15:46 +08:00
|
|
|
<HttpProvider>
|
2024-11-18 01:09:28 +08:00
|
|
|
<CapabilityProvider>
|
2024-11-27 01:02:05 +08:00
|
|
|
<RouteProvider>{children}</RouteProvider>
|
2024-11-18 01:09:28 +08:00
|
|
|
</CapabilityProvider>
|
2024-11-30 02:15:46 +08:00
|
|
|
</HttpProvider>
|
2024-11-17 17:17:40 +08:00
|
|
|
);
|