eletrotupi / tcc/ commit / b4ed0db

frontend: match the mood entry response field to the api

Pedro Lucas Porcellis porcellis@eletrotupi.com · 12 days ago b4ed0dbe37bd3128e040c3ce7d1ed9784bba4951 Browse files
Parents 74e7b35
Changed files
2
Additions
+2
Deletions
-2
frontend/app/(tabs)/new/entry.tsx
1 1
import { useState, useEffect } from "react";
2 2
import { Link, router, useLocalSearchParams } from "expo-router";
3 3

4 4
import { View, StyleSheet, ScrollView } from "react-native";
5 5

63 63
        intensity: intensityToValue(c.intensity),
64 64
      })),
65 65
    };
66 66

67 67
    const result = await createMoodEntry.mutateAsync(data);
68 -
    const moodId = (result as any).mood?.id ?? (result as any).moodEntry?.id;
68 +
    const moodId = result.mood.id;
69 69

70 70
    const careActionId = useCareActionLinkStore.getState().linkMood();
71 71
    if (careActionId && moodId) {
72 72
      await patchCareAction.mutateAsync({
73 73
        id: String(careActionId),
213 213
  },
214 214
  resumeCard: {
215 215
    padding: Spacing.cardGap,
216 216
  },
217 217
});
frontend/lib/api/types.ts
1 1
export interface User {
2 2
  id: number;
3 3
  email: string;
4 4
  firstName: string;
5 5
  lastName?: string;
225 225
  page: number;
226 226
  nextPage: number | null;
227 227
}
228 228

229 229
export interface MoodEntryResponse {
230 -
  moodEntry: MoodEntry;
230 +
  mood: MoodEntry;
231 231
}
232 232

233 233
export interface SleepRecordResponse {
234 234
  sleepRecord: SleepRecord;
235 235
}
389 389
  moodId?: number;
390 390
}
391 391
export interface MedicineRegimenResponse { regimen: MedicineRegimen; }
392 392

393 393
export interface LinkMoodPayload { moodId: number; perceivedImpact: number; }