@@ -1,9 +1,10 @@
11import React, { useCallback, useEffect, useState } from 'react';
22import { FormProvider, useForm } from 'react-hook-form';
33import { Link } from 'react-router-dom';
4+import api from '../api';
45import { PostOptions } from '../components/PostOptions';
56import { useApps } from '../state/apps';
6−import { PostOption, PostOptionsForm } from '../types/sphinx';
7+import { Declare, Listing, PostOption, PostOptionsForm } from '../types/sphinx';
78
89function getAppKeys(apps: PostOption[]): string[] {
910 return apps.map(({ key }) => key);
@@ -27,9 +28,19 @@ export const Apps = () => {
2728 }
2829 }, [apps, options, setValue]);
2930
30− const onSubmit = useCallback(() => {
31+ const onSubmit = useCallback((values: PostOptionsForm) => {
32+ debugger;
33+ api.poke<Declare[]>({
34+ app: 'sphinx',
35+ mark: 'declarations',
36+ json: apps.filter(a => values.options.includes(a.key)).map(a => ({
37+ post: a.post,
38+ reach: 'friends'
39+ }))
40+ });
41+
3142 reset();
32− }, [reset]);
43+ }, [apps, reset]);
3344
3445 return (
3546 <>