wwf
2025-05-20 938c3e5a587ce950a94964ea509b9e7f8834dfae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import type { StateCreator } from 'zustand'
import type { EnvironmentVariable } from '@/app/components/workflow/types'
 
export type EnvVariableSliceShape = {
  showEnvPanel: boolean
  setShowEnvPanel: (showEnvPanel: boolean) => void
  environmentVariables: EnvironmentVariable[]
  setEnvironmentVariables: (environmentVariables: EnvironmentVariable[]) => void
  envSecrets: Record<string, string>
  setEnvSecrets: (envSecrets: Record<string, string>) => void
}
 
export const createEnvVariableSlice: StateCreator<EnvVariableSliceShape> = set => ({
  showEnvPanel: false,
  setShowEnvPanel: showEnvPanel => set(() => ({ showEnvPanel })),
  environmentVariables: [],
  setEnvironmentVariables: environmentVariables => set(() => ({ environmentVariables })),
  envSecrets: {},
  setEnvSecrets: envSecrets => set(() => ({ envSecrets })),
})