OHO-11(Partial Before Duplication)
This commit is contained in:
parent
1e856bbd8f
commit
594e8b6353
5 changed files with 12 additions and 8 deletions
|
|
@ -155,7 +155,7 @@ app.post('/api/transaction/add', async (req, res) => {
|
|||
const { description, amount, userId } = req.body;
|
||||
if (!userId) return res.status(400).json({ error: 'Missing userId' });
|
||||
|
||||
const predictRes = await axios.post('http://192.168.1.10:5000/api/predict', {
|
||||
const predictRes = await axios.post('http://10.231.8.114:5000/api/predict', {
|
||||
description,
|
||||
});
|
||||
const category = predictRes.data.category || 'Other';
|
||||
|
|
@ -221,7 +221,7 @@ app.post('/api/transactions/voice', async (req, res) => {
|
|||
.trim();
|
||||
const description = cleaned || 'misc';
|
||||
// Step 3: Predict category using your Flask API
|
||||
const predictRes = await axios.post('http://192.168.1.10:5000/api/predict', {
|
||||
const predictRes = await axios.post('http://10.231.8.114:5000/api/predict', {
|
||||
description,
|
||||
});
|
||||
const category = predictRes.data?.category || 'Other';
|
||||
|
|
@ -373,7 +373,7 @@ app.post('/api/sync-gmail', async (req, res) => {
|
|||
}
|
||||
let category = 'Other';
|
||||
try {
|
||||
const predictRes = await axios.post('http://192.168.1.10:5000/api/predict', {
|
||||
const predictRes = await axios.post('http://10.231.8.114:5000/api/predict', {
|
||||
description: parsed.vendor || "Unknown"
|
||||
}, { timeout: 5000 }); // Optional timeout
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import 'package:flutter/material.dart';
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:monarch/other_pages/enviroment.dart';
|
||||
|
||||
class AutoSyncEmailsScreen extends StatefulWidget {
|
||||
final String accessToken;
|
||||
final String userId; // userId now required by backend
|
||||
|
|
@ -38,7 +40,7 @@ class _AutoSyncEmailsScreenState extends State<AutoSyncEmailsScreen> {
|
|||
|
||||
try {
|
||||
final response = await http.post(
|
||||
Uri.parse("http://192.168.1.10:3000/api/sync-gmail"),
|
||||
Uri.parse("${Environment.baseUrl}/api/sync-gmail"),
|
||||
headers: {"Content-Type": "application/json"},
|
||||
body: jsonEncode({
|
||||
"accessToken": widget.accessToken,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:monarch/other_pages/enviroment.dart';
|
||||
|
||||
class EmailsScreen extends StatefulWidget {
|
||||
final String accessToken;
|
||||
final String userId;
|
||||
|
|
@ -29,7 +31,7 @@ class _EmailsScreenState extends State<EmailsScreen> {
|
|||
|
||||
Future<void> fetchEmails() async {
|
||||
try {
|
||||
final uri = Uri.parse("http://192.168.1.10:3000/api/sync-gmail");
|
||||
final uri = Uri.parse("${Environment.baseUrl}/api/sync-gmail");
|
||||
|
||||
final res = await http.post(
|
||||
uri,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
// }
|
||||
|
||||
// // Step 3: Send token to backend
|
||||
// final uri = Uri.parse("http://192.168.1.10:3000/auth/google/token");
|
||||
// final uri = Uri.parse("${Environment.baseUrl}/auth/google/token");
|
||||
// final res = await http.post(
|
||||
// uri,
|
||||
// headers: {"Content-Type": "application/json"},
|
||||
|
|
@ -163,7 +163,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||
}
|
||||
|
||||
// Send idToken to backend for login
|
||||
final uri = Uri.parse("http://192.168.1.10:3000/auth/google/token");
|
||||
final uri = Uri.parse("${Environment.baseUrl}/auth/google/token");
|
||||
final res = await http.post(
|
||||
uri,
|
||||
headers: {"Content-Type": "application/json"},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class Environment {
|
||||
static const String baseUrl = 'http://192.168.1.10:3000';
|
||||
static const String baseUrl = 'http://10.231.8.114:3000';
|
||||
static const String serverClientId =
|
||||
"278433619849-cg6f7gk5cc45rgu1ojrlkf794lm4udgn.apps.googleusercontent.com";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue