# extendify/0.10.1/src/Onboarding/api/DataApi.js

Extendify, version 0.10.1. 40 lines.

- Page: https://pluginprobe.com/plugins/extendify/0.10.1/code/src/Onboarding/api/DataApi.js
- Raw: https://pluginprobe.com/plugins/extendify/0.10.1/raw/src/Onboarding/api/DataApi.js
- Modified: 2022-08-25T21:16:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/0.10.1/code/src/Onboarding/api/DataApi.js#L10-L20`.

```javascript
import { getHeadersAndFooters } from './WPApi'
import { Axios as api } from './axios'

export const getSiteTypes = () => api.get('onboarding/site-types')

export const getStyles = async (data) => {
    // First get the header and footer code
    const styles = await api.get('onboarding/styles', { params: data })
    const { headers, footers } = await getHeadersAndFooters()
    if (!styles?.data?.length) {
        throw new Error('Could not get styles')
    }
    return {
        data: styles.data.map((style) => {
            const header = headers?.find(
                (h) => h?.slug === style?.headerSlug ?? 'header',
            )
            const footer = footers?.find(
                (f) => f?.slug === style?.footerSlug ?? 'footer',
            )

            return {
                ...style,
                headerCode: header?.content?.raw?.trim() ?? '',
                footerCode: footer?.content?.raw?.trim() ?? '',
            }
        }),
    }
}

export const getGoals = () => api.get('onboarding/goals')
export const getSuggestedPlugins = () => api.get('onboarding/suggested-plugins')

export const getLayoutTypes = () => api.get('onboarding/layout-types')

export const getTemplate = (data) =>
    api.get('onboarding/template', { params: data })

export const createOrder = () => api.post('onboarding/create-order')

```
