From 4e7665e2f5054ff53494938c90fa8e64b9077a96 Mon Sep 17 00:00:00 2001 From: Clement G Date: Sun, 19 Apr 2020 11:49:43 +0200 Subject: [PATCH] style(error-code): prettier auto-format --- src/Errors.js | 44 ++++++++++++++++++++------------------------ src/errorCode.js | 36 ++++++++++++++++++------------------ 2 files changed, 38 insertions(+), 42 deletions(-) diff --git a/src/Errors.js b/src/Errors.js index 27f8c11..2a92c08 100644 --- a/src/Errors.js +++ b/src/Errors.js @@ -1,45 +1,41 @@ -import React from 'react'; -import { - Container, - Row, - Col, -} from "reactstrap"; +import React from "react"; +import { Container, Row, Col } from "reactstrap"; -export const UNKNOWN_ELECTION_ERROR = 'E1'; -export const ONGOING_ELECTION_ERROR = 'E2'; -export const NO_VOTE_ERROR = 'E3'; -export const ELECTION_NOT_STARTED_ERROR = 'E4'; -export const ELECTION_FINISHED_ERROR = 'E5'; -export const INVITATION_ONLY_ERROR = 'E6'; -export const UNKNOWN_TOKEN_ERROR = 'E7'; -export const USED_TOKEN_ERROR = 'E8'; -export const WRONG_ELECTION_ERROR = 'E9'; +export const UNKNOWN_ELECTION_ERROR = "E1"; +export const ONGOING_ELECTION_ERROR = "E2"; +export const NO_VOTE_ERROR = "E3"; +export const ELECTION_NOT_STARTED_ERROR = "E4"; +export const ELECTION_FINISHED_ERROR = "E5"; +export const INVITATION_ONLY_ERROR = "E6"; +export const UNKNOWN_TOKEN_ERROR = "E7"; +export const USED_TOKEN_ERROR = "E8"; +export const WRONG_ELECTION_ERROR = "E9"; export const redirectError = (errorMsg, history) => {}; export const errorMessage = (error, t) => { if (error.startsWith(UNKNOWN_ELECTION_ERROR)) { - return t('Oops... The election is unknown.'); + return t("Oops... The election is unknown."); } else if (error.startsWith(ONGOING_ELECTION_ERROR)) { return t( - "The election is still going on. You can't access now to the results.", + "The election is still going on. You can't access now to the results." ); } else if (error.startsWith(NO_VOTE_ERROR)) { - return t('No votes have been recorded yet. Come back later.'); + return t("No votes have been recorded yet. Come back later."); } else if (error.startsWith(ELECTION_NOT_STARTED_ERROR)) { - return t('The election has not started yet.'); + return t("The election has not started yet."); } else if (error.startsWith(ELECTION_FINISHED_ERROR)) { - return t('The election is over. You can\'t vote anymore'); + return t("The election is over. You can't vote anymore"); } else if (error.startsWith(INVITATION_ONLY_ERROR)) { - return t('You need a token to vote in this election'); + return t("You need a token to vote in this election"); } else if (error.startsWith(USED_TOKEN_ERROR)) { - return t('You seem to have already voted.'); + return t("You seem to have already voted."); } else if (error.startsWith(WRONG_ELECTION_ERROR)) { - return t('The parameters of the election are incorrect.'); + return t("The parameters of the election are incorrect."); } }; -export const Error = (props) => ( +export const Error = props => ( diff --git a/src/errorCode.js b/src/errorCode.js index 7299b1a..4d763fa 100644 --- a/src/errorCode.js +++ b/src/errorCode.js @@ -1,35 +1,35 @@ -import React from 'react'; +import React from "react"; -export const UNKNOWN_ELECTION_ERROR = 'E1'; -export const ONGOING_ELECTION_ERROR = 'E2'; -export const NO_VOTE_ERROR = 'E3'; -export const ELECTION_NOT_STARTED_ERROR = 'E4'; -export const ELECTION_FINISHED_ERROR = 'E5'; -export const INVITATION_ONLY_ERROR = 'E6'; -export const UNKNOWN_TOKEN_ERROR = 'E7'; -export const USED_TOKEN_ERROR = 'E8'; -export const WRONG_ELECTION_ERROR = 'E9'; +export const UNKNOWN_ELECTION_ERROR = "E1"; +export const ONGOING_ELECTION_ERROR = "E2"; +export const NO_VOTE_ERROR = "E3"; +export const ELECTION_NOT_STARTED_ERROR = "E4"; +export const ELECTION_FINISHED_ERROR = "E5"; +export const INVITATION_ONLY_ERROR = "E6"; +export const UNKNOWN_TOKEN_ERROR = "E7"; +export const USED_TOKEN_ERROR = "E8"; +export const WRONG_ELECTION_ERROR = "E9"; export const redirectError = (errorMsg, history) => {}; export const errorMessage = (error, t) => { if (error.startsWith(UNKNOWN_ELECTION_ERROR)) { - return t('Oops... The election is unknown.'); + return t("Oops... The election is unknown."); } else if (error.startsWith(ONGOING_ELECTION_ERROR)) { return t( - "The election is still going on. You can't access now to the results.", + "The election is still going on. You can't access now to the results." ); } else if (error.startsWith(NO_VOTE_ERROR)) { - return t('No votes have been recorded yet. Come back later.'); + return t("No votes have been recorded yet. Come back later."); } else if (error.startsWith(ELECTION_NOT_STARTED_ERROR)) { - return t('The election has not started yet.'); + return t("The election has not started yet."); } else if (error.startsWith(ELECTION_FINISHED_ERROR)) { - return t('The election is over. You can\'t vote anymore'); + return t("The election is over. You can't vote anymore"); } else if (error.startsWith(INVITATION_ONLY_ERROR)) { - return t('You need a token to vote in this election'); + return t("You need a token to vote in this election"); } else if (error.startsWith(USED_TOKEN_ERROR)) { - return t('You seem to have already voted.'); + return t("You seem to have already voted."); } else if (error.startsWith(WRONG_ELECTION_ERROR)) { - return t('The parameters of the election are incorrect.'); + return t("The parameters of the election are incorrect."); } };