feat: init new response state system
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { pluck } from "rxjs/operators"
|
||||
import { combineLatest } from "rxjs"
|
||||
import { map, pluck } from "rxjs/operators"
|
||||
import DispatchingStore, {
|
||||
defineDispatchers,
|
||||
} from "~/newstore/DispatchingStore"
|
||||
@@ -202,6 +203,24 @@ export const selectedEnvIndex$ = environmentsStore.subject$.pipe(
|
||||
pluck("currentEnvironmentIndex")
|
||||
)
|
||||
|
||||
export const currentEnvironment$ = combineLatest([
|
||||
environments$,
|
||||
selectedEnvIndex$,
|
||||
]).pipe(
|
||||
map(([envs, selectedIndex]) => {
|
||||
if (selectedIndex === -1) {
|
||||
const env: Environment = {
|
||||
name: "No Environment",
|
||||
variables: [],
|
||||
}
|
||||
|
||||
return env
|
||||
} else {
|
||||
return envs[selectedIndex]
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
export function getCurrentEnvironment(): Environment {
|
||||
if (environmentsStore.value.currentEnvironmentIndex === -1) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user