This commit is contained in:
Franck 2021-12-07 15:18:00 +11:00
parent beae8c2857
commit 7f641c35a6
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 10 additions and 9 deletions

View File

@ -11,7 +11,7 @@ import { WakuMessaging } from './WakuMessaging'
import { Web3Provider } from '@ethersproject/providers'
import { WakuMessagesSetup } from '../types/WakuMessagesSetup'
export enum MESSEGAGE_SENDING_RESULT {
export enum MESSAGE_SENDING_RESULT {
ok = 0,
notEnoughToken = 1,
errorCreatingMessage = 2,
@ -76,12 +76,12 @@ export class WakuPolling extends WakuMessaging {
const pollInit = await PollInitMsg.create(signer, question, answers, pollType, this.chainId, minToken, endTime)
if (pollInit) {
await this.sendWakuMessage(this.wakuMessages['pollInit'], pollInit)
return MESSEGAGE_SENDING_RESULT.ok
return MESSAGE_SENDING_RESULT.ok
} else {
return MESSEGAGE_SENDING_RESULT.errorCreatingMessage
return MESSAGE_SENDING_RESULT.errorCreatingMessage
}
} else {
return MESSEGAGE_SENDING_RESULT.notEnoughToken
return MESSAGE_SENDING_RESULT.notEnoughToken
}
}
@ -96,13 +96,13 @@ export class WakuPolling extends WakuMessaging {
if (pollVote) {
await this.sendWakuMessage(this.wakuMessages['pollVote'], pollVote)
} else {
return MESSEGAGE_SENDING_RESULT.errorCreatingMessage
return MESSAGE_SENDING_RESULT.errorCreatingMessage
}
} else {
return MESSEGAGE_SENDING_RESULT.notEnoughToken
return MESSAGE_SENDING_RESULT.notEnoughToken
}
} else {
return MESSEGAGE_SENDING_RESULT.pollNotFound
return MESSAGE_SENDING_RESULT.pollNotFound
}
}

View File

@ -3,6 +3,7 @@ import styled from 'styled-components'
import { PollType } from '@dappconnect/vote-poll-sdk-core/dist/esm/src/types/PollType'
import { WakuPolling } from '@dappconnect/vote-poll-sdk-core'
import { Input, addIcon, SmallButton, Modal, Theme } from '@dappconnect/vote-poll-sdk-react-components'
import { MESSAGE_SENDING_RESULT } from '@dappconnect/vote-poll-sdk-core/dist/esm/src/classes/WakuPolling'
function getLocaleIsoTime(dateTime: Date) {
const MS_PER_MINUTE = 60000
@ -92,10 +93,10 @@ export function PollCreation({ wakuPolling, theme, setShowPollCreation }: PollCr
undefined,
endTimePicker.getTime()
)
if (result === 0) {
if (result === MESSAGE_SENDING_RESULT.ok) {
setShowCreateConfirmation(true)
}
if (result === 1) {
if (result === MESSAGE_SENDING_RESULT.notEnoughToken) {
setShowNotEnoughTokens(true)
}
}}