Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Applications: React.FunctionComponent = () => {
const { t } = useTranslation('applications')
useDocumentTitle(t('listing.page_title'))
const columns = [
'Name',
'State',
'Account',
'Plan',
'Created at'
]
let rows
const { data, isPending } = useFetch(
'/applications',
{ headers: { Accept: 'application/json' } }
)
if (!isPending && data) {
const applications = data.applications.application // TODO: Check the server side xml2json
const applicationsArray = Array.isArray(applications) ? applications : [{ ...applications }]
rows = applicationsArray.map(
(app: any) => ({
cells: [
app.name,
app.state,
'Developer',
app.plan.name,
app.created_at