@stackend/api
Version:
JS bindings to api.stackend.com
53 lines • 1.31 kB
TypeScript
import { VoteSummary, Vote } from './index';
import { Comment } from '../comments';
export declare const XCAP_VOTES_RECEIVED = "XCAP_VOTES_RECEIVED";
export declare const XCAP_VOTES_UPDATE = "XCAP_VOTES_UPDATE";
declare type VoteActionBase = {
context: string;
/**
* Has the current user voted?
*/
hasVoted?: boolean;
/**
* My review comment, if any
*/
myReview?: Comment | null;
/**
* Summary of votes
*/
voteSummary: VoteSummary;
};
export declare type VoteActions = (VoteActionBase & {
type: typeof XCAP_VOTES_RECEIVED;
votes: {
[referenceGroupId: number]: Vote;
};
}) | (VoteActionBase & {
type: typeof XCAP_VOTES_UPDATE;
vote: Vote;
});
export interface VoteInfo {
/**
* Summary of votes
*/
voteSummary: VoteSummary;
votes: {
[referenceGroupId: number]: Vote;
};
/**
* Has the current user voted?
* */
hasVoted: boolean;
/**
* My review comment, if any
*/
myReview?: Comment | null;
}
export interface VoteState {
[context: string]: {
[referenceId: string]: VoteInfo;
};
}
declare const voteReducer: (state: VoteState | undefined, action: VoteActions) => VoteState;
export default voteReducer;
//# sourceMappingURL=voteReducer.d.ts.map