feat: 凍結された場合のダイアログを実装 (#7811)

* feat: 凍結された場合のダイアログを実装

* Update CHANGELOG.md

* Update basic.js

* improve error handling

* cypressなんもわからん

* Update basic.js
This commit is contained in:
syuilo
2021-09-19 02:23:12 +09:00
committed by GitHub
parent 6d4e96dea2
commit 54e0a7f8a8
8 changed files with 186 additions and 66 deletions

View File

@@ -3,6 +3,7 @@ import { reactive } from 'vue';
import { apiUrl } from '@client/config';
import { waiting } from '@client/os';
import { unisonReload, reloadChannel } from '@client/scripts/unison-reload';
import { showSuspendedDialog } from './scripts/show-suspended-dialog';
// TODO: 他のタブと永続化されたstateを同期
@@ -82,17 +83,20 @@ function fetchAccount(token): Promise<Account> {
i: token
})
})
.then(res => res.json())
.then(res => {
// When failed to authenticate user
if (res.status !== 200 && res.status < 500) {
return signout();
if (res.error) {
if (res.error.id === 'a8c724b3-6e9c-4b46-b1a8-bc3ed6258370') {
showSuspendedDialog().then(() => {
signout();
});
} else {
signout();
}
} else {
res.token = token;
done(res);
}
// Parse response
res.json().then(i => {
i.token = token;
done(i);
});
})
.catch(fail);
});