@@ -1,9 +1,10 @@
1import React, { useCallback, useEffect, useState } from 'react';
1import React, { useCallback, useEffect, useState } from 'react';
2import { FormProvider, useForm } from 'react-hook-form';
2import { FormProvider, useForm } from 'react-hook-form';
3import { Link } from 'react-router-dom';
3import { Link } from 'react-router-dom';
4+import api from '../api';
4import { PostOptions } from '../components/PostOptions';
5import { PostOptions } from '../components/PostOptions';
5import { useApps } from '../state/apps';
6import { useApps } from '../state/apps';
6−import { PostOption, PostOptionsForm } from '../types/sphinx';
7+import { Declare, Listing, PostOption, PostOptionsForm } from '../types/sphinx';
8function getAppKeys(apps: PostOption[]): string[] {
9function getAppKeys(apps: PostOption[]): string[] {
9 return apps.map(({ key }) => key);
10 return apps.map(({ key }) => key);
@@ -27,9 +28,19 @@ export const Apps = () => {
28 }, [apps, options, setValue]);
29 }, [apps, options, setValue]);
30− const onSubmit = useCallback(() => {
31+ const onSubmit = useCallback((values: PostOptionsForm) => {
33+ api.poke<Declare[]>({
35+ mark: 'declarations',
36+ json: apps.filter(a => values.options.includes(a.key)).map(a => ({
32− }, [reset]);
43+ }, [apps, reset]);