@@ -8,21 +8,17 @@ import { Session } from '../../stores/session.js'
88import { Answer , Vote } from '../../stores/votes.js'
99import { httpInstance , createCancelTokenHandler } from './HttpApi.js'
1010import { Comment } from '../../stores/comments.js'
11- import { Poll } from '../../stores/poll.js'
1211import { Share } from '../../stores/shares.js'
1312import { SentResults } from './shares.js'
13+ import {
14+ AddOptionResponse ,
15+ FullPollResponse ,
16+ RemoveVotesResponse ,
17+ setVoteResponse ,
18+ } from './api.types.js'
1419
1520const publicPoll = {
16- getPoll ( shareToken : string ) : Promise <
17- AxiosResponse < {
18- poll : Poll
19- options : Option [ ]
20- votes : Vote [ ]
21- comments : Comment [ ]
22- shares : Share [ ]
23- subscribed : boolean
24- } >
25- > {
21+ getPoll ( shareToken : string ) : Promise < AxiosResponse < FullPollResponse > > {
2622 return httpInstance . request ( {
2723 method : 'GET' ,
2824 url : `/s/${ shareToken } /poll` ,
@@ -63,14 +59,7 @@ const publicPoll = {
6359 option : SimpleOption ,
6460 sequence : Sequence | null ,
6561 voteYes : boolean = false ,
66- ) : Promise <
67- AxiosResponse < {
68- option : Option
69- repetitions : Option [ ]
70- options : Option [ ]
71- votes : Vote [ ]
72- } >
73- > {
62+ ) : Promise < AxiosResponse < AddOptionResponse > > {
7463 return httpInstance . request ( {
7564 method : 'POST' ,
7665 url : `/s/${ shareToken } /option` ,
@@ -129,9 +118,7 @@ const publicPoll = {
129118 shareToken : string ,
130119 optionId : number ,
131120 setTo : Answer ,
132- ) : Promise <
133- AxiosResponse < { vote : Vote ; poll : Poll ; options : Option [ ] ; votes : Vote [ ] } >
134- > {
121+ ) : Promise < AxiosResponse < setVoteResponse > > {
135122 return httpInstance . request ( {
136123 method : 'PUT' ,
137124 url : `s/${ shareToken } /vote` ,
@@ -146,9 +133,7 @@ const publicPoll = {
146133 } )
147134 } ,
148135
149- resetVotes (
150- shareToken : string ,
151- ) : Promise < AxiosResponse < { poll : Poll ; options : Option [ ] ; votes : Vote [ ] } > > {
136+ resetVotes ( shareToken : string ) : Promise < AxiosResponse < RemoveVotesResponse > > {
152137 return httpInstance . request ( {
153138 method : 'DELETE' ,
154139 url : `s/${ shareToken } /user` ,
@@ -161,7 +146,7 @@ const publicPoll = {
161146
162147 removeOrphanedVotes (
163148 shareToken : string ,
164- ) : Promise < AxiosResponse < { poll : Poll ; options : Option [ ] ; votes : Vote [ ] } > > {
149+ ) : Promise < AxiosResponse < RemoveVotesResponse > > {
165150 return httpInstance . request ( {
166151 method : 'DELETE' ,
167152 url : `s/${ shareToken } /votes/orphaned` ,
0 commit comments