Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/patiencemanzen/bugpack
Different approaches to validate and get your application's incoming error responses from laravel
https://github.com/patiencemanzen/bugpack
laravel npm-package patienceman vuejs
Last synced: about 2 months ago
JSON representation
Different approaches to validate and get your application's incoming error responses from laravel
- Host: GitHub
- URL: https://github.com/patiencemanzen/bugpack
- Owner: patiencemanzen
- Created: 2023-04-24T09:10:07.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-01T12:51:10.000Z (over 1 year ago)
- Last Synced: 2024-10-13T19:46:11.629Z (3 months ago)
- Topics: laravel, npm-package, patienceman, vuejs
- Language: JavaScript
- Homepage:
- Size: 175 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bugpack
User-friendly library designed to streamline the process of data validation and error message handling in Vue.js applications.
You can effortlessly implement validation logic, ensuring your data remains accurate and consistent with laravel.## Installation
To install the package don't require much requirement except to paste the following compand in laravel terminal, and the you're good to go.
```bash
npm i patienceman-bugpack
```## Usage
Import the package in your workspace
```javascript
import Bugpack from "patienceman-bugpack";
```initialize the bugpack and it will by default create error holder object for u 🎉, and it apply the some in
``` vue.js ```, ``` react.js ``` and ``` node.js ```
```javascript
// node.js
const packer = new Bugpack();
packer.defineForm({ password: "manirabona", username: "username" });
// vue.js
export default {
data() {
return {
user_data: {
username: "",
password: ""
},
bugger: new Bugpacker(),
};
},
methods: {
createPost() {
this.bugger.defineForm(this.user_data);
axios.post("/api/post", this.bugger.models())
.then(() => this.success = true)
.catch((error) => {
this.bugger.alignWith(error.response.data.errors);
});
}
}
}
```
So once u create and defined your form data, now u can use or get all created data:
```javascript
// Get all models/object
packer.models();
// get all errors/object
packer.errors();
// Single error --> bugpack it will add 'Error' to created model
packer.usernameError;
```
For vue.js devs u can map the error like:
```html
{{ bugger.usernameError }}
```## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)