2024-11-17 17:17:40 +08:00
|
|
|
import { CapabilityService } from "services/capabilityService";
|
|
|
|
import { ThemeService } from "services/themeService";
|
2024-11-18 01:09:28 +08:00
|
|
|
import { ApiService } from "services/apiService";
|
|
|
|
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-22 13:13:04 +08:00
|
|
|
export const { ThemeProvider, useTheme } = createServiceContext("Theme", () =>
|
|
|
|
ThemeService.getInstance(),
|
2024-11-17 17:17:40 +08:00
|
|
|
);
|
2024-11-14 23:01:21 +08:00
|
|
|
|
2024-11-22 13:13:04 +08:00
|
|
|
export const { ApiProvider, useApi } = createServiceContext("Api", () =>
|
|
|
|
ThemeService.getInstance(),
|
2024-11-18 01:09:28 +08:00
|
|
|
);
|
|
|
|
|
2024-11-17 17:17:40 +08:00
|
|
|
export const ServiceProvider = ({ children }: { children: ReactNode }) => (
|
2024-11-18 01:09:28 +08:00
|
|
|
<ApiProvider>
|
|
|
|
<CapabilityProvider>
|
2024-11-22 13:13:04 +08:00
|
|
|
<ThemeProvider>{children}</ThemeProvider>
|
2024-11-18 01:09:28 +08:00
|
|
|
</CapabilityProvider>
|
|
|
|
</ApiProvider>
|
2024-11-17 17:17:40 +08:00
|
|
|
);
|