File size: 538 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { useMutation } from '@tanstack/react-query';
import wpcom from 'calypso/lib/wp';

type LinkAnswersMutationArgs = {
	blogId: number;
	surveyKey: string;
};

const useLinkAnswersMutation = () => {
	return useMutation( {
		mutationFn: async ( { blogId, surveyKey }: LinkAnswersMutationArgs ) => {
			return wpcom.req.post( {
				path: '/segmentation-survey/answers/link',
				apiNamespace: 'wpcom/v2',
				body: {
					blog_id: blogId,
					survey_key: surveyKey,
				},
			} );
		},
	} );
};

export default useLinkAnswersMutation;