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