missions api2

This commit is contained in:
alma 2025-05-06 17:30:59 +02:00
parent feedf8addf
commit d9d8a402bf

View File

@ -19,21 +19,23 @@ export class OutlineService {
console.log('Mission data received:', JSON.stringify({
id: mission.id,
label: mission.label,
name: mission.name,
description: mission.description
}, null, 2));
// Check if the mission label (used as name) is available
if (!mission.label) {
console.warn('Mission is missing a label, using default name');
}
// Determine the best name to use for the collection
// Prioritize mission.name, then mission.label, then default
const collectionName = mission.name || mission.label || `Mission ${mission.id}`;
console.log(`Using collection name: "${collectionName}"`);
try {
// Create a collection in Outline based on the mission
const payload = {
name: mission.label || 'New Mission',
name: collectionName,
description: mission.description || 'Mission documentation',
color: '#4f46e5', // Indigo color as default
permission: 'read_write'
permission: 'read_write',
private: true // Make the collection private
};
console.log('Sending to Outline API:', JSON.stringify(payload, null, 2));