Skip to content

Commit d3b5531

Browse files
authored
Merge pull request #4916 from brave-intl/fix/uphold-errors
2 parents 5cc0b9a + a4018e0 commit d3b5531

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

app/controllers/api/nextv1/home_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class Api::Nextv1::HomeController < Api::Nextv1::BaseController
22
include PublishersHelper
3+
include ActionController::Flash
34

45
before_action :prompt_for_two_factor_setup, only: %i[dashboard]
56

@@ -22,7 +23,8 @@ def dashboard
2223
response_data = {
2324
publisher: publisher,
2425
channels: channels,
25-
wallet_data: wallet_data
26+
wallet_data: wallet_data,
27+
flash_data: {alert: flash[:alert], notice: flash[:notice]}
2628
}
2729

2830
render(json: response_data.to_json, status: 200)

nextjs/src/app/[locale]/publishers/home/page.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use client';
22

3+
import Alert from '@brave/leo/react/alert';
34
import Button from '@brave/leo/react/button';
45
import Collapse from '@brave/leo/react/collapse';
56
import Dialog from '@brave/leo/react/dialog';
@@ -31,6 +32,8 @@ export default function HomePage() {
3132
const [isLoading, setIsLoading] = useState(true);
3233
const [channels, setChannels] = useState([]);
3334
const [publisherId, setPublisherId] = useState('');
35+
const [alert, setAlert] = useState(null);
36+
const [notice, setNotice] = useState(null);
3437
const [isAddChannelModalOpen, setIsAddChannelModalOpen] = useState(false);
3538
const [isCollapseOpen, setIsCollapseOpen] = useState(true);
3639
const searchParams = useSearchParams();
@@ -47,6 +50,8 @@ export default function HomePage() {
4750
setCustodianData(res.wallet_data);
4851
setPublisherId(res.publisher.id);
4952
setChannels(res.channels);
53+
setAlert(res.flash_data.alert);
54+
setNotice(res.flash_data.notice);
5055
setIsLoading(false);
5156
if (startWithModalOpen) {
5257
setIsAddChannelModalOpen(true);
@@ -68,6 +73,12 @@ export default function HomePage() {
6873
return (
6974
<main className='main transition-colors'>
7075
<Container>
76+
{alert && (
77+
<Alert className='mb-3'>{alert}</Alert>
78+
)}
79+
{notice && (
80+
<Alert className='mb-3' type='warning'>{notice}</Alert>
81+
)}
7182
<div className='mx-auto max-w-screen-lg'>
7283
<Collapse isOpen={isCollapseOpen} onToggle={()=>{setIsCollapseOpen(!isCollapseOpen)}}>
7384
<div slot='title'><h4>{t('Home.headings.how_to_receive')}</h4></div>

0 commit comments

Comments
 (0)