diff --git a/src/components/activation-code/activation-code-activate.jsx b/src/components/activation-code/activation-code-activate.jsx index 47ffb447..da16a488 100644 --- a/src/components/activation-code/activation-code-activate.jsx +++ b/src/components/activation-code/activation-code-activate.jsx @@ -1,22 +1,17 @@ import { React, useState, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; -import { - usePostV1ExternalUserActivationCodesActivateMutation, - usePostV1ExternalUserActivationCodesMutation -} from "../../redux/api/api.generated"; -import ActivationCodeForm from "./activation-code-form"; +import Form from "react-bootstrap/Form"; +import { Button } from "react-bootstrap"; +import { usePostV1ExternalUserActivationCodesActivateMutation } from "../../redux/api/api.generated"; import { displaySuccess, - displayError + displayError, } from "../util/list/toast-component/display-toast"; import LoadingComponent from "../util/loading-component/loading-component"; -import Form from "react-bootstrap/Form"; import ContentBody from "../util/content-body/content-body"; import FormInput from "../util/forms/form-input"; -import RadioButtons from "../util/forms/radio-buttons"; import ContentFooter from "../util/content-footer/content-footer"; -import { Button } from "react-bootstrap"; /** * The user create component. @@ -25,17 +20,16 @@ import { Button } from "react-bootstrap"; */ function ActivationCodeActivate() { const { t } = useTranslation("common", { - keyPrefix: "activation-code-create" + keyPrefix: "activation-code-create", }); const navigate = useNavigate(); - const headerText = t("activate-activation-code-header"); const [formStateObject, setFormStateObject] = useState({ - activationCode: "" + activationCode: "", }); const [ PostV1ExternalUserActivationCodeActivate, - { error: saveError, isLoading: isSaving, isSuccess: isSaveSuccess } + { error: saveError, isLoading: isSaving, isSuccess: isSaveSuccess }, ] = usePostV1ExternalUserActivationCodesActivateMutation(); /** Handle submitting is done. */ @@ -69,15 +63,18 @@ function ActivationCodeActivate() { const handleSubmit = () => { PostV1ExternalUserActivationCodeActivate({ externalUserActivationCodeExternalUserActivateInput: - JSON.stringify(formStateObject) + JSON.stringify(formStateObject), }); }; return ( <> - +
-

{t('header')}

+

{t("header")}

{ fetch(`${config.api}v1/authentication/token/refresh`, { mode: "cors", - method: 'POST', + method: "POST", headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", }, credentials: "include", body: JSON.stringify({ - refresh_token: localStorage.getItem(localStorageKeys.API_REFRESH_TOKEN), - }) + refresh_token: localStorage.getItem( + localStorageKeys.API_REFRESH_TOKEN + ), + }), }) .then((resp) => resp.json()) .then((data) => { @@ -138,7 +143,7 @@ function Login() { displayError(t("error-refreshing-code"), err); }); }); - } + }; const onActivationCodeSubmit = (e) => { e.preventDefault(); @@ -151,7 +156,7 @@ function Login() { }), }) ) - .then((resp) => { + .then(() => { refreshTokenAndLogin(); }) .catch((err) => { diff --git a/src/redux/api.js b/src/redux/api.js index fc5f3abf..8abaf0a1 100644 --- a/src/redux/api.js +++ b/src/redux/api.js @@ -23,7 +23,7 @@ generatedApi.enhanceEndpoints({ "FeedSource", "Feed", "ActivationCode", - "User" + "User", ], endpoints: { getV1FeedSources: {