missions api2
This commit is contained in:
parent
65ce7d460b
commit
feedf8addf
@ -16,16 +16,31 @@ export class OutlineService {
|
|||||||
throw new Error('Outline API token is not configured');
|
throw new Error('Outline API token is not configured');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('Mission data received:', JSON.stringify({
|
||||||
|
id: mission.id,
|
||||||
|
label: mission.label,
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Create a collection in Outline based on the mission
|
// Create a collection in Outline based on the mission
|
||||||
|
const payload = {
|
||||||
|
name: mission.label || 'New Mission',
|
||||||
|
description: mission.description || 'Mission documentation',
|
||||||
|
color: '#4f46e5', // Indigo color as default
|
||||||
|
permission: 'read_write'
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('Sending to Outline API:', JSON.stringify(payload, null, 2));
|
||||||
|
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
`${this.apiUrl}/collections.create`,
|
`${this.apiUrl}/collections.create`,
|
||||||
{
|
payload,
|
||||||
name: mission.label,
|
|
||||||
description: mission.description || 'Mission documentation',
|
|
||||||
color: '#4f46e5', // Indigo color as default,
|
|
||||||
permission: 'read_write'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@ -45,6 +60,7 @@ export class OutlineService {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (axios.isAxiosError(error)) {
|
if (axios.isAxiosError(error)) {
|
||||||
|
console.error('Full error response:', JSON.stringify(error.response?.data, null, 2));
|
||||||
if (error.response?.status === 401) {
|
if (error.response?.status === 401) {
|
||||||
console.error('Outline authentication error:', error.response.data);
|
console.error('Outline authentication error:', error.response.data);
|
||||||
throw new Error('Outline API authentication failed - check your token');
|
throw new Error('Outline API authentication failed - check your token');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user