missions api2

This commit is contained in:
alma 2025-05-06 17:18:33 +02:00
parent 943ee01698
commit 65ce7d460b

View File

@ -19,19 +19,12 @@ export class OutlineService {
try {
// Create a collection in Outline based on the mission
const response = await axios.post(
`${this.apiUrl}/collections`,
`${this.apiUrl}/collections.create`,
{
name: mission.label,
description: mission.description || 'Mission documentation',
color: '#4f46e5', // Indigo color as default
permission: 'read_write',
// Added extra fields that might be useful for identifying the collection
private: false,
external: true,
meta: {
missionId: mission.id,
createdAt: new Date().toISOString()
}
color: '#4f46e5', // Indigo color as default,
permission: 'read_write'
},
{
headers: {
@ -41,8 +34,12 @@ export class OutlineService {
}
);
console.log('Outline API response:', JSON.stringify(response.data, null, 2));
if (response.data && response.data.data && response.data.data.id) {
return response.data.data.id;
} else if (response.data && response.data.id) {
return response.data.id;
} else {
throw new Error('Failed to get collection ID from Outline API response');
}
@ -70,8 +67,11 @@ export class OutlineService {
try {
// Delete the collection in Outline
await axios.delete(
`${this.apiUrl}/collections/${collectionId}`,
await axios.post(
`${this.apiUrl}/collections.delete`,
{
id: collectionId
},
{
headers: {
'Content-Type': 'application/json',