mirror of
https://gitee.com/mafgwo/stackedit
synced 2024-11-16 03:32:40 +08:00
优化share
This commit is contained in:
parent
1daa5afe39
commit
0e02822add
|
@ -125,7 +125,9 @@ export default {
|
|||
const url = `${window.location.protocol}//${window.location.host}/share.html?id=${gistId}`;
|
||||
await store.dispatch('modal/open', { type: 'shareHtml', name: currentFile.name, url });
|
||||
} catch (err) {
|
||||
/* cancel */
|
||||
if (err) {
|
||||
store.dispatch('notification/error', err);
|
||||
}
|
||||
} finally {
|
||||
this.sharing = false;
|
||||
}
|
||||
|
|
|
@ -87,16 +87,14 @@
|
|||
window.onload = function() {
|
||||
const xhr = new XMLHttpRequest();
|
||||
const gistId = getQueryString('id');
|
||||
const workspaces = window.localStorage.getItem('data/workspaces');
|
||||
let accessToken = null;
|
||||
if (workspaces) {
|
||||
const workspacesObj = JSON.parse(workspaces);
|
||||
const sub = workspacesObj.data && workspacesObj.data.main && workspacesObj.data.main.sub;
|
||||
if (sub) {
|
||||
const tokens = window.localStorage.getItem('data/tokens');
|
||||
if (tokens) {
|
||||
const tokensObj = JSON.parse(tokens);
|
||||
accessToken = tokensObj.data && tokensObj.data.gitee && tokensObj.data.gitee[sub] && tokensObj.data.gitee[sub].accessToken;
|
||||
const tokens = window.localStorage.getItem('data/tokens');
|
||||
if (tokens) {
|
||||
const tokensObj = JSON.parse(tokens);
|
||||
if (tokensObj.data && tokensObj.data.gitee) {
|
||||
const tokenArr = Object.keys(tokensObj.data.gitee).map(it => tokensObj.data.gitee[it]).filter(it => it && it.isLogin);
|
||||
if (tokenArr.length > 0) {
|
||||
accessToken = tokenArr[0].accessToken;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user