missions api2
This commit is contained in:
parent
943ee01698
commit
65ce7d460b
@ -19,19 +19,12 @@ export class OutlineService {
|
|||||||
try {
|
try {
|
||||||
// Create a collection in Outline based on the mission
|
// Create a collection in Outline based on the mission
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
`${this.apiUrl}/collections`,
|
`${this.apiUrl}/collections.create`,
|
||||||
{
|
{
|
||||||
name: mission.label,
|
name: mission.label,
|
||||||
description: mission.description || 'Mission documentation',
|
description: mission.description || 'Mission documentation',
|
||||||
color: '#4f46e5', // Indigo color as default
|
color: '#4f46e5', // Indigo color as default,
|
||||||
permission: 'read_write',
|
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()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
headers: {
|
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) {
|
if (response.data && response.data.data && response.data.data.id) {
|
||||||
return response.data.data.id;
|
return response.data.data.id;
|
||||||
|
} else if (response.data && response.data.id) {
|
||||||
|
return response.data.id;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Failed to get collection ID from Outline API response');
|
throw new Error('Failed to get collection ID from Outline API response');
|
||||||
}
|
}
|
||||||
@ -70,8 +67,11 @@ export class OutlineService {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Delete the collection in Outline
|
// Delete the collection in Outline
|
||||||
await axios.delete(
|
await axios.post(
|
||||||
`${this.apiUrl}/collections/${collectionId}`,
|
`${this.apiUrl}/collections.delete`,
|
||||||
|
{
|
||||||
|
id: collectionId
|
||||||
|
},
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user