You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
755 B
23 lines
755 B
3 years ago
|
import { aoEnv } from './settings.js'
|
||
|
import { getCard } from './api.js'
|
||
|
|
||
|
// Prints the text (.name) of the first card prioritized in the logged-in users member card
|
||
|
export async function getTopPriorityText() {
|
||
|
// Get the first priority of my member card
|
||
|
const memberId = aoEnv('AO_CLI_SESSION_MEMBERID')
|
||
|
if(!memberId) {
|
||
|
return 'Not logged in'
|
||
|
}
|
||
|
const fetchedCards = await getCard(memberId, 'priority')
|
||
|
console.log('fetch result:', fetchedCards)
|
||
|
if(!fetchedCards || fetchedCards.length < 2) {
|
||
|
return 'None'
|
||
|
}
|
||
|
const firstPriorityCard = fetchedCards[1]
|
||
|
return firstPriorityCard.name
|
||
|
}
|
||
|
|
||
|
// Makes an API request to get the first prioritized card in the member card of the logged-in user
|
||
|
async function getFirstPriorityCard() {
|
||
|
|
||
|
}
|