mirror of
https://github.com/NoCrypt/migu.git
synced 2026-01-11 20:10:22 +00:00
Merge branch 'master' of https://github.com/RockinChaos/miru into pr-test
This commit is contained in:
commit
5a7d2ad505
2 changed files with 6 additions and 6 deletions
|
|
@ -119,16 +119,16 @@ class MALClient {
|
|||
} catch (e) {
|
||||
if (!res || res.status !== 404) throw e
|
||||
}
|
||||
if (!res.ok && (res.status === 429 || res.status === 500)) {
|
||||
if (!res?.ok && (res?.status === 429 || res?.status === 500)) {
|
||||
throw res
|
||||
}
|
||||
let json = null
|
||||
try {
|
||||
json = await res.json()
|
||||
} catch (error) {
|
||||
if (res.ok) printError(error)
|
||||
if (res?.ok) printError(error)
|
||||
}
|
||||
if (!res.ok && res.status !== 404) {
|
||||
if (!res?.ok && res?.status !== 404) {
|
||||
if (json) {
|
||||
for (const error of json?.errors || [json?.error] || []) {
|
||||
let code = error
|
||||
|
|
@ -154,7 +154,7 @@ class MALClient {
|
|||
code = 422
|
||||
break
|
||||
default:
|
||||
code = res.status
|
||||
code = res?.status
|
||||
}
|
||||
printError(code)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,8 +148,8 @@ export async function refreshMalToken (token) {
|
|||
})
|
||||
})
|
||||
}
|
||||
if (!refresh || !(refresh.length > 0) || !response.ok) {
|
||||
toast.error('Failed to re-authenticate with MyAnimeList. You will need to log in again.', { description: JSON.stringify(response.status) })
|
||||
if (!refresh || !(refresh.length > 0) || !response?.ok) {
|
||||
toast.error('Failed to re-authenticate with MyAnimeList. You will need to log in again.', { description: JSON.stringify(response?.status || response) })
|
||||
debug(`Failed to refresh MyAnimeList User Token ${ !refresh || !(refresh.length > 0) ? 'as the refresh token could not be fetched!' : ': ' + JSON.stringify(response)}`)
|
||||
if (malToken?.token === token) {
|
||||
swapProfiles(null)
|
||||
|
|
|
|||
Loading…
Reference in a new issue