@crudadmin/helpers is the frontend half of every project. Use it in every Nuxt website, Ionic + Capacitor app and Vue SPA talking to a CrudAdmin backend, so all projects request, authenticate and share data the same way. The CrudAdmin administration uses it too.
Source: github.com/crudadmin/crudhelpers. The package README.md is the full API reference, MIGRATION-*.md describe the upgrades.
What it contains
Requirements
- Vue 3.4+, Pinia 3 or 4. In Nuxt also
@pinia/nuxt. @ionic/vue,@capacitor/keyboardand@capacitor/networkonly for@crudadmin/helpers/capacitor.- On the backend:
crudadmin/helpersfor the bootstrap request and auth, andcrudadmin/autoajaxwith'store' => true.
Installation
Nuxt
Extend the layer. It registers the plugins, the stores and the auto-imports, souseAxios(), useResponse(), useAuth(), __() and the stores work without an import.
nuxt.config.ts
crudadmin are described in App boot and auth and Localization.
The layer is used by other layers too: @crudadmin/eshop extends it, registers its own stores and headers, and turns the bootstrap on.
Vite, Ionic or Vue without Nuxt
Without Nuxt there is no layer, so the app wires the pieces itself inmain.js:
src/main.js
refreshApp() of such an app fetches the bootstrap itself and passes the response to useResponse(), see Without the Nuxt layer.
For auto-imports, add the helpers stores to unplugin-auto-import and re-export the composables:
vite.config.js
src/composables/helpers.js
The administration
The CrudAdmin administration is a Vue SPA built on the same package. It loadsGET /admin/api/bootstrap, binds the store object into its Pinia stores through Response, installs CrudadminVue for the gettext catalog of the locale store, and uses Modal and Toast. Its own backend class Admin\Bootstrap\AdminBootstrapRequest extends the same Admin\Core\Bootstrap\BootstrapRequest as the AppRequest of your projects. See Admin Vue API.