From 2135f2e4f4e218e95f374fa89b2157e68bb103ba Mon Sep 17 00:00:00 2001 From: cutls Date: Thu, 1 Apr 2021 17:13:21 +0900 Subject: [PATCH] Sometimes cannot use with Mastodon continuously --- app/js/login/login.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/js/login/login.js b/app/js/login/login.js index 54b914a5..605b4103 100644 --- a/app/js/login/login.js +++ b/app/js/login/login.js @@ -307,10 +307,13 @@ async function refresh(target, loadskip) { let at = obj[target].at if (obj[target].rt) { console.log('refresh access token') - at = await refreshPleromaAt(obj[target]) - localStorage.setItem(`acct_${target}_at`, at) - obj[target].at = at - localStorage.setItem(`multi`, JSON.stringify(obj)) + const atk = await refreshPleromaAt(obj[target]) + if (atk) { + at = atk + localStorage.setItem(`acct_${target}_at`, at) + obj[target].at = at + localStorage.setItem(`multi`, JSON.stringify(obj)) + } } var start = 'https://' + obj[target].domain + '/api/v1/accounts/verify_credentials' fetch(start, {