mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-02-03 06:36:44 +00:00
21 lines
656 B
TypeScript
21 lines
656 B
TypeScript
|
import * as ViewModels from "../Contracts/ViewModels";
|
||
|
import { PlatformType } from "../PlatformType";
|
||
|
import { PortalTokenProvider } from "./PortalTokenProvider";
|
||
|
|
||
|
export class TokenProviderFactory {
|
||
|
private constructor() {}
|
||
|
|
||
|
public static create(): ViewModels.TokenProvider {
|
||
|
const platformType = window.dataExplorerPlatform;
|
||
|
switch (platformType) {
|
||
|
case PlatformType.Portal:
|
||
|
case PlatformType.Hosted:
|
||
|
return new PortalTokenProvider();
|
||
|
case PlatformType.Emulator:
|
||
|
default:
|
||
|
// should never get into this state
|
||
|
throw new Error(`Unknown platform ${platformType}`);
|
||
|
}
|
||
|
}
|
||
|
}
|