From e843169bf01229e8735c3fb784441e9de2c23a14 Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Tue, 27 Nov 2018 09:52:03 +0100 Subject: [PATCH] Create getVocabulary selector Feature #14393 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- src/store/vocabulary/vocabulary-selctors.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/store/vocabulary/vocabulary-selctors.ts diff --git a/src/store/vocabulary/vocabulary-selctors.ts b/src/store/vocabulary/vocabulary-selctors.ts new file mode 100644 index 00000000..aad4608b --- /dev/null +++ b/src/store/vocabulary/vocabulary-selctors.ts @@ -0,0 +1,16 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +import { PropertiesState, getProperty } from '~/store/properties/properties'; +import { Vocabulary } from '~/models/vocabulary'; + +export const VOCABULARY_PROPERTY_NAME = 'vocabulary'; + +const DEFAULT_VOCABULARY: Vocabulary = { + strict: false, + tags: [], +}; + +export const getVocabulary = (state: PropertiesState) => + getProperty(VOCABULARY_PROPERTY_NAME)(state) || DEFAULT_VOCABULARY; -- 2.30.2