Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function StoreForm({ save, cancel, store }) {
const { t } = useTranslations();
const { dataStore } = useOrbit();
const {
result: { storeTypes },
} = useQuery({ storeTypes: [(q) => q.findRecords('storeType'), buildOptions()] });
const attributes = attributesFor(store || {});
const isEditing = !!store;
const existingStoreType = useMemo(() => getStoreType(dataStore, store), [dataStore, store]);
// Form States
const [name, setName] = useState(attributes.name || '');
const [storeType, setStoreType] = useState(existingStoreType);
const [description, setDescription] = useState(attributes.description || '');
const [errors, setError] = useState>({});
// End Form States
const onSubmit = async (e) => {
e.preventDefault();
e.stopPropagation();
return function ProjectDataFetcher(props) {
const { match } = useRouter();
const {
params: { id },
} = match;
const {
isLoading,
error,
result: { project },
} = useQuery({
project: [
(q) => buildFindRecord(q, 'project', id),
buildOptions({
include: [
'products.product-builds.product-artifacts',
'products.product-builds.product-publications',
'products.user-tasks.user',
// 'products.user-tasks.product.product-definition.workflow',
'products.product-definition',
// 'products.product-workflow',
'organization.organization-product-definitions.product-definition.workflow.store-type',
'group',
'owner.group-memberships.group',
'owner.organization-memberships.organization',
'reviewers',
'type',
export default function EditForm() {
const { t } = useTranslations();
const { update } = useDataActions();
const { history, match } = useRouter();
const { id } = match.params || {};
const {
result: { store },
isLoading,
} = useQuery({
store: [(q) => buildFindRecord(q, 'store', id), buildOptions({ include: ['store-type'] })],
});
if (isLoading) {
return ;
}
const save = async (attributes, relationships) => {
await update(store, attributes, relationships);
toast.success(t('models.updateSuccess', { name: t('stores.name') }));
history.push(paths.settings.stores.path());
};
const cancel = () => {
history.push(paths.settings.stores.path());
export function useUserTasksList(include?: string[]) {
const requestOptions = buildOptions({
include: include || defaultInclude,
});
const queryTask = useQuery({
userTasks: [
(q) => {
const builder = q.findRecords('userTask');
return builder;
},
requestOptions,
],
});
return { ...queryTask, userTasks: queryTask.result.userTasks };
}