diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-03-19 15:22:55 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-03-19 15:22:55 +0900 |
| commit | 898daf24d12cb02b72ce128f8b143ad39d95620a (patch) | |
| tree | 73ccc3b7dc509779e9a751794dca8839f3bd845f /src/web/app/boot.js | |
| parent | [API] Better appdata get/set endpoints (BREAKING) (diff) | |
| download | misskey-898daf24d12cb02b72ce128f8b143ad39d95620a.tar.gz misskey-898daf24d12cb02b72ce128f8b143ad39d95620a.tar.bz2 misskey-898daf24d12cb02b72ce128f8b143ad39d95620a.zip | |
[Client] Follow api changes and some cleanups
Diffstat (limited to 'src/web/app/boot.js')
| -rw-r--r-- | src/web/app/boot.js | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/web/app/boot.js b/src/web/app/boot.js index 24981c5889..cdedcd5003 100644 --- a/src/web/app/boot.js +++ b/src/web/app/boot.js @@ -65,7 +65,7 @@ export default callback => { // Get cached account data let cachedMe = JSON.parse(localStorage.getItem('me')); - if (cachedMe && cachedMe.data && cachedMe.data.cache) { + if (cachedMe) { fetched(cachedMe); // 後から新鮮なデータをフェッチ @@ -74,11 +74,6 @@ export default callback => { cachedMe.trigger('updated'); }); } else { - // キャッシュ無効なのにキャッシュが残ってたら掃除 - if (cachedMe) { - localStorage.removeItem('me'); - } - // Get token from cookie const i = (document.cookie.match(/i=(!\w+)/) || [null, null])[1]; @@ -94,14 +89,12 @@ export default callback => { me.trigger('updated'); }; - if (me.data.cache) { - localStorage.setItem('me', JSON.stringify(me)); + localStorage.setItem('me', JSON.stringify(me)); - me.on('updated', () => { - // キャッシュ更新 - localStorage.setItem('me', JSON.stringify(me)); - }); - } + me.on('updated', () => { + // キャッシュ更新 + localStorage.setItem('me', JSON.stringify(me)); + }); } mixin(me); @@ -164,7 +157,7 @@ function fetchme(token, cb) { function init() { const data = generateDefaultUserdata(); api(token, 'i/appdata/set', { - data: JSON.stringify(data) + set: data }).then(() => { me.data = data; done(); |