Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions scripts/private-destination.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ const PRIVATE_DESTINATIONS = yaml.load(fs.readFileSync(path.resolve(__dirname, `
const privateDests = PRIVATE_DESTINATIONS.items
let private = []
const getCatalog = async (url, page_token = "MA==") => {
let res = null
try {
const res = await axios.get(url, {
res = await axios.get(url, {
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.PAPI_TOKEN}`
Expand All @@ -33,10 +34,14 @@ const getCatalog = async (url, page_token = "MA==") => {
}
}
});

return res.data
} catch (error) {
console.log(error)
} catch (err) {
console.error("Error response:");
console.error(err.response.data); // ***
console.error(err.response.status); // ***
console.error(err.response.headers); // ***
} finally {

}
}

Expand All @@ -48,6 +53,9 @@ const checkDestinationStatus = async (id) => {
}
const getDestinationData = async (id) => {
const res = await getCatalog(`${PAPI_URL}/catalog/destinations/${id}`)
if (res == null) {
return
}
let destination = res.data.destinationMetadata
let settings = destination.options
settings.sort((a, b) => {
Expand Down