fix(mobile): use dynamic platform in feedback, add null coercion, add Content-Type on flush

- settings.tsx: replace hardcoded platform: 'ios' with APP_PLATFORM from app-metadata
- feedback-client.ts: add ?? '' null coercion on getAuthToken (matches broadcast/survey pattern)
- offline-queue.ts: add Content-Type: application/json header on flush requests
This commit is contained in:
saravanakumardb1 2026-03-31 00:49:40 -07:00
parent a761ec9ee0
commit 9d3ac06234
3 changed files with 4 additions and 2 deletions

View File

@ -3,6 +3,7 @@ import { Alert, Pressable, ScrollView, StyleSheet, Text, TextInput, View } from
import { router } from 'expo-router'; import { router } from 'expo-router';
import { useAuthStore, type AuthState } from '../../store/auth-store'; import { useAuthStore, type AuthState } from '../../store/auth-store';
import { getFeedbackClient } from '../../lib/feedback-client'; import { getFeedbackClient } from '../../lib/feedback-client';
import { APP_PLATFORM } from '../../lib/app-metadata';
import { colors } from '../../theme'; import { colors } from '../../theme';
type FeedbackType = 'bug' | 'feature' | 'praise' | 'other'; type FeedbackType = 'bug' | 'feature' | 'praise' | 'other';
@ -27,7 +28,7 @@ export default function SettingsScreen() {
type: feedbackType, type: feedbackType,
title, title,
body: feedbackBody.trim() || undefined, body: feedbackBody.trim() || undefined,
platform: 'ios', platform: APP_PLATFORM,
}); });
setFeedbackTitle(''); setFeedbackTitle('');
setFeedbackBody(''); setFeedbackBody('');

View File

@ -8,7 +8,7 @@ export function getFeedbackClient(): FeedbackClient {
if (!feedbackClient) { if (!feedbackClient) {
feedbackClient = createFeedbackClient({ feedbackClient = createFeedbackClient({
baseUrl: API_CONFIG.platformBaseUrl, baseUrl: API_CONFIG.platformBaseUrl,
getAuthToken: () => getAuthClient().getAccessToken(), getAuthToken: () => getAuthClient().getAccessToken() ?? '',
}); });
} }

View File

@ -64,6 +64,7 @@ export async function flushNoteQueue(): Promise<{ flushed: number; failed: numbe
return noteOfflineQueue.flush(async (action, path, payload) => { return noteOfflineQueue.flush(async (action, path, payload) => {
await getApiClient().fetch(path, { await getApiClient().fetch(path, {
method: action === 'create' ? 'POST' : 'PATCH', method: action === 'create' ? 'POST' : 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload), body: JSON.stringify(payload),
}); });
}); });