Skip to content

Commit

Permalink
chore: add translations and constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Chisomchima committed Nov 20, 2024
1 parent 13df357 commit c497def
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
13 changes: 11 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-11-19T09:39:21.743Z\n"
"PO-Revision-Date: 2024-11-19T09:39:21.743Z\n"
"POT-Creation-Date: 2024-11-20T09:43:43.959Z\n"
"PO-Revision-Date: 2024-11-20T09:43:43.960Z\n"

msgid "Never"
msgstr "Never"
Expand Down Expand Up @@ -367,6 +367,15 @@ msgstr "Personal access tokens"
msgid "About DHIS2"
msgstr "About DHIS2"

msgid "Email verification link sent successfully!"
msgstr "Email verification link sent successfully!"

msgid "Failed to send email verification link."
msgstr "Failed to send email verification link."

msgid "Verify Email"
msgstr "Verify Email"

msgid "Manage personal access tokens"
msgstr "Manage personal access tokens"

Expand Down
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const DEV_BASE_URL = 'http://localhost:8080/api/'
11 changes: 7 additions & 4 deletions src/layout/VerifyEmail.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Button, CircularLoader } from '@dhis2/ui'
import { getInstance as getD2 } from 'd2'
import PropTypes from 'prop-types'
import React, { useState } from 'react'
import { DEV_BASE_URL } from '../constants.js'
import i18n from '../locales/index.js'

const systemSettingsQuery = {
systemSettings: {
Expand Down Expand Up @@ -33,17 +35,18 @@ export function VerifyEmail({ userEmail }) {
try {
const d2 = await getD2()
const api = d2.Api.getApi()
api.baseUrl = 'http://localhost:8080/api/'
api.baseUrl = DEV_BASE_URL

await api.post('account/sendEmailVerification')
successAlert.show({
message: 'Email verification link sent successfully!',
message: i18n.t('Email verification link sent successfully!'),
})
} catch (err) {
console.error('Error:', err)
errorAlert.show({
message:
err.message || 'Failed to send email verification link.',
err.message ||
i18n.t('Failed to send email verification link.'),
})
} finally {
setIsLoading(false)
Expand All @@ -57,7 +60,7 @@ export function VerifyEmail({ userEmail }) {
onClick={handleEmailVerification}
disabled={isButtonDisabled}
>
Verify Email
{i18n.t('Verify Email')}
</Button>
{isLoading && <CircularLoader small />}
</div>
Expand Down

0 comments on commit c497def

Please sign in to comment.