// in trainingData.ts
try {
const { data: { session } } = await supabase.auth.getSession();
if (!session) {
return {
error: 'User not authenticated',
errorKey: 'auth.errors.notAuthenticated'
};
}
const { data, error } = await supabase.functions.invoke('prepare-training-data');
if (error) {
console.error('Error calling prepare-training-data function:', error);
return {
error: 'Failed to fetch training data',
errorKey: 'training.errors.fetchFailed',
message: error.message
};
}
...
}
// in trainingData.ts
try {
const { data: { session } } = await supabase.auth.getSession();
if (!session) {
return {
error: 'User not authenticated',
errorKey: 'auth.errors.notAuthenticated'
};
}
const { data, error } = await supabase.functions.invoke('prepare-training-data');
if (error) {
console.error('Error calling prepare-training-data function:', error);
return {
error: 'Failed to fetch training data',
errorKey: 'training.errors.fetchFailed',
message: error.message
};
}
...
}