Skip to content

Commit

Permalink
pref: clear login status only if token expired
Browse files Browse the repository at this point in the history
  • Loading branch information
cnwangjie committed Oct 13, 2018
1 parent ddc6f85 commit 4be85b1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### v1.3.11 10/13/2018

- change: refine i18n strings
- fix: change of openTabListWhenNewTab take effect immediately
- feat: add an option to allow disable open list tab when store all tabs
- pref: clear login status only if token expired

### v1.3.10 10/3/2018

- feat: allow store tabs into a specific list by clicking the items in context menu or a button in the simple list
Expand Down
12 changes: 8 additions & 4 deletions src/common/service/boss.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,19 @@ const fetchData = async (uri = '', method = 'GET', data = {}) => {
.then(async res => {
if (res.status === 200) {
const json = await res.json()
if (json.status === 'error') throw new Error(json.message)
return json
} else return res.text()
})
.catch(async err => {
// remove expired token
await browser.storage.local.remove(tokenKey)
await browser.storage.local.remove('sync_info')
console.error(err)
throw new Error('Internal Server Error')
if (err.status === 401) {
await browser.storage.local.remove(tokenKey)
await browser.storage.local.remove('sync_info')
} else {
console.error(err)
throw new Error('Internal Server Error')
}
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_ext_name__",
"version": "1.4.0",
"version": "1.3.11",
"default_locale": "en",
"description": "__MSG_ext_desc__",
"author": "WangJie <[email protected]>",
Expand Down

0 comments on commit 4be85b1

Please sign in to comment.