1- import { createAsyncThunk } from "@reduxjs/toolkit" ;
2- import { API } from "api" ;
3- import { ApplicationState , retryable } from "store" ;
4- import { CreateVotingRequest } from "./types" ;
1+ import { createAsyncThunk } from "@reduxjs/toolkit" ;
2+ import { API } from "api" ;
3+ import { ApplicationState , retryable } from "store" ;
4+ import { CreateVotingRequest } from "./types" ;
55
6- export const createVoting = createAsyncThunk < void , CreateVotingRequest , { state : ApplicationState } > ( "votings/createVoting" , async ( payload , { dispatch, getState} ) => {
6+ export const createVoting = createAsyncThunk < void , CreateVotingRequest , { state : ApplicationState } > ( "votings/createVoting" , async ( payload , { dispatch, getState } ) => {
77 const boardId = getState ( ) . board . data ! . id ;
88
99 await retryable (
1010 ( ) => API . createVoting ( boardId , payload ) ,
1111 dispatch ,
12- ( ) => createVoting ( { ...payload } ) ,
12+ ( ) => createVoting ( { ...payload } ) ,
1313 "createVoting"
1414 ) ;
1515} ) ;
1616
17- export const closeVoting = createAsyncThunk < void , string , { state : ApplicationState } > ( "votings/closeVoting" , async ( payload , { dispatch, getState} ) => {
17+ export const closeVoting = createAsyncThunk < void , string , { state : ApplicationState } > ( "votings/closeVoting" , async ( payload , { dispatch, getState } ) => {
1818 const boardId = getState ( ) . board . data ! . id ;
1919
2020 await retryable (
@@ -25,13 +25,13 @@ export const closeVoting = createAsyncThunk<void, string, {state: ApplicationSta
2525 ) ;
2626} ) ;
2727
28- export const cancelVoting = createAsyncThunk < void , string , { state : ApplicationState } > ( "votings/cancelVoting " , async ( payload , { dispatch, getState} ) => {
28+ export const abortVoting = createAsyncThunk < void , string , { state : ApplicationState } > ( "votings/abortVoting " , async ( payload , { dispatch, getState } ) => {
2929 const boardId = getState ( ) . board . data ! . id ;
3030
3131 await retryable (
3232 ( ) => API . changeVotingStatus ( boardId , payload , "ABORTED" ) ,
3333 dispatch ,
34- ( ) => cancelVoting ( payload ) ,
35- "cancelVoting "
34+ ( ) => abortVoting ( payload ) ,
35+ "abortVoting "
3636 ) ;
3737} ) ;
0 commit comments