robertolangarica / quasar-app-extension-api-wrapper Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hello,
This is a nice utility. I wish there was some example on how to use it globally.
I was trying to set Global Configuration but it wasn't clear to me in which file to put theme.
I tried src\main\webapp\quasar.extensions.json
with the following ( the "api-wrapper" was created automatically I don't know what for):
{
"api-wrapper": {
"baseURL" : "http://localhost:8080/api/v1/"
}
}
that didn't work...
also as a boot file
// import something here
// "async" is optional;
// more info on params: https://quasar.dev/quasar-cli/boot-files
// export default async (/* { app, router, Vue ... } */) => {
export default async ({ app, router, store, Vue }) => {
// something to do
console.log('boot api-wrapper start')
// `baseURL` will be prepended to any path provided unless the provided path is absolute.
this.$api.baseURL = 'http://localhost:8080/api/v1'
// The amount of attempts a request will make in the case of a timeout before failing completely
this.$api.maxAttemptsPerCall = 1
// The amount of concurrent requests that could be executed (when the requests number exceed this amount the requests are enqueue in a waiting mode)
this.$api.simultaneousCalls = 5
// Specifies the number of milliseconds before a request times out
this.$api.timeout = 10000
// Sets the default headers for 'Content-Type' for each request
this.$api.setContentType(type = 'application/json')
// Sets the default authorization header: 'Authorization' for each request
this.$api.setAuthorization(token, type = 'Bearer')
// If the store where not provided in the boot phase then it could be passed to the extension using this function
// This will bring the module 'APIwrapper' available and the extension will start updating its state
this.$api.setStore(vuex_instance)
console.log('boot api-wrapper end')
}
got the below errors
Failed to compile.
./src/boot/api-wrapper-global.js
Module Error (from ./node_modules/eslint-loader/dist/cjs.js):
C:\src\git-repos\l4p-app\src\main\webapp\src\boot\api-wrapper-global.js
23:28 error 'type' is not defined no-undef
26:30 error 'token' is not defined no-undef
26:37 error 'type' is not defined no-undef
30:22 error 'vuex_instance' is not defined no-undef
โ 4 problems (4 errors, 0 warnings)
Not to do this in every request?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.