Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enable test alerts display in test mode #114

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/routes/api/oba/alerts/+server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export async function GET() {
'alerts.pb',
PRIVATE_OBACO_SHOW_TEST_ALERTS && PRIVATE_OBACO_SHOW_TEST_ALERTS == 'true' ? { test: 1 } : {}
);

const response = await fetch(alertsURL);

const buffer = await response.arrayBuffer();
Expand All @@ -17,6 +18,11 @@ export async function GET() {

let validAlert = null;
for (const entity of feed.entity) {
// If we're in test mode, show the alert to test the UI
if (PRIVATE_OBACO_SHOW_TEST_ALERTS) {
validAlert = entity.alert;
break;
}
if (entity.alert && isValidAlert(entity.alert)) {
validAlert = entity.alert;
break;
Expand Down
Loading