gitscope
← marzneshin / nightly / dashboard/src/modules/hosts/dialogs/mutation/profiles/use-profile-strategy.ts
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/modules/hosts/dialogs/mutation/profiles/use-profile-strategy.ts · TypeScript
Blame Raw
 1import { ProtocolType } from "@marzneshin/modules/inbounds";
 2import { generalProfile, profileByProtocol, ProfileConfig } from "./profiles";
 3
 4/**
 5 * @param {ProtocolType} protocol - Inbound protocol of host
 6 * @returns {ProfileConfig} config - An array of schema, profile fields, and their default
 7 * @default *General Profile* if no protocol is specified
 8 */
 9export const useProfileStrategy = (protocol?: ProtocolType): ProfileConfig => {
10    return protocol && profileByProtocol[protocol]
11        ? profileByProtocol[protocol]
12        : generalProfile;
13};