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:
parent
a761ec9ee0
commit
9d3ac06234
@ -3,6 +3,7 @@ import { Alert, Pressable, ScrollView, StyleSheet, Text, TextInput, View } from
|
||||
import { router } from 'expo-router';
|
||||
import { useAuthStore, type AuthState } from '../../store/auth-store';
|
||||
import { getFeedbackClient } from '../../lib/feedback-client';
|
||||
import { APP_PLATFORM } from '../../lib/app-metadata';
|
||||
import { colors } from '../../theme';
|
||||
|
||||
type FeedbackType = 'bug' | 'feature' | 'praise' | 'other';
|
||||
@ -27,7 +28,7 @@ export default function SettingsScreen() {
|
||||
type: feedbackType,
|
||||
title,
|
||||
body: feedbackBody.trim() || undefined,
|
||||
platform: 'ios',
|
||||
platform: APP_PLATFORM,
|
||||
});
|
||||
setFeedbackTitle('');
|
||||
setFeedbackBody('');
|
||||
|
||||
@ -8,7 +8,7 @@ export function getFeedbackClient(): FeedbackClient {
|
||||
if (!feedbackClient) {
|
||||
feedbackClient = createFeedbackClient({
|
||||
baseUrl: API_CONFIG.platformBaseUrl,
|
||||
getAuthToken: () => getAuthClient().getAccessToken(),
|
||||
getAuthToken: () => getAuthClient().getAccessToken() ?? '',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -64,6 +64,7 @@ export async function flushNoteQueue(): Promise<{ flushed: number; failed: numbe
|
||||
return noteOfflineQueue.flush(async (action, path, payload) => {
|
||||
await getApiClient().fetch(path, {
|
||||
method: action === 'create' ? 'POST' : 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user