mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-04 12:26:19 +00:00
feat: add workspace security setting definition
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { PlanType } from "@/types/proto/api/v1/subscription_service";
|
||||
|
||||
export const stringifyPlanType = (planType: PlanType) => {
|
||||
export const stringifyPlanType = (planType: PlanType = PlanType.FREE) => {
|
||||
if (planType === PlanType.FREE) {
|
||||
return "Free";
|
||||
} else if (planType === PlanType.PRO) {
|
||||
|
@ -24,17 +24,17 @@ const useWorkspaceStore = create<WorkspaceState>()((set, get) => ({
|
||||
profile: WorkspaceProfile.fromPartial({}),
|
||||
setting: WorkspaceSetting.fromPartial({}),
|
||||
fetchWorkspaceProfile: async () => {
|
||||
const workspaceProfile = (await workspaceServiceClient.getWorkspaceProfile({})).profile as WorkspaceProfile;
|
||||
const workspaceProfile = await workspaceServiceClient.getWorkspaceProfile({});
|
||||
set({ ...get(), profile: workspaceProfile });
|
||||
return workspaceProfile;
|
||||
},
|
||||
fetchWorkspaceSetting: async () => {
|
||||
const workspaceSetting = (await workspaceServiceClient.getWorkspaceSetting({})).setting as WorkspaceSetting;
|
||||
const workspaceSetting = await workspaceServiceClient.getWorkspaceSetting({});
|
||||
set({ ...get(), setting: workspaceSetting });
|
||||
return workspaceSetting;
|
||||
},
|
||||
checkFeatureAvailable: (feature: FeatureType): boolean => {
|
||||
return get().profile.features.includes(feature);
|
||||
return get().profile.subscription?.features.includes(feature) || false;
|
||||
},
|
||||
}));
|
||||
|
||||
|
Reference in New Issue
Block a user