Comments (1)
Hi @Liero
This might be because Backbone doesn't have good support for being treated as an ES6 class. Try the following:
import { Model } from 'backbone';
import { LocalStorage } from 'backbone.localstorage';
const UserModel = Model.extend({
localStorage = new LocalStorage('api/Account'),
url: '/api/Account',
fromServer() {
return this.fetch({
crossDomain: true,
xhrFields: {
withCredentials: true
},
ajaxSync: true
});
}
})
Then, instead of calling fetch, you call fromServer
so you have the option to retrieve your credentials from Local Storage elsewhere in your app from the model.
from backbone.localstorage.
Related Issues (20)
- Regex error on _clear method
- require config localstorage makes 'Load timeout for modules' error HOT 1
- Duplicate values in records when calling create method multiple times HOT 1
- how to fetch collection from localstorage ?? HOT 9
- Rename to BackboneStorage HOT 1
- Multi-page for local data is empty HOT 1
- underscore.js HOT 1
- Signatures for success() and error() not (model, resp, options)
- Doesn't work with Browserify HOT 2
- Maintaining LocalStorage HOT 4
- Remove Unmaintained Description HOT 2
- Wrong path for main in package.json HOT 1
- Disable console.log in LocalStorage HOT 1
- Webpack required to build usable bacbone.localstorage.js file in browser? HOT 4
- Loading Backbone LocalStorage with requirejs returns an error HOT 5
- Models not saving correctly under version 2.0.0 HOT 3
- Bug in "destroy" metod of localStorage.js HOT 2
- Delete a model from local storage HOT 1
- findAll() returns array and breaks model.fetch()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backbone.localstorage.