-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: [Client][Settings/Server] サーバーのメンテナンス機能を実装
この API もようやく数年越しに日の目を見ることに…
- Loading branch information
1 parent
5903dce
commit 0492f27
Showing
3 changed files
with
151 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
|
||
import APIClient from '@/services/APIClient'; | ||
|
||
|
||
class Maintenance { | ||
|
||
|
||
/** | ||
* データベースを更新する | ||
*/ | ||
static async updateDatabase(): Promise<void> { | ||
|
||
// API リクエストを実行 | ||
const response = await APIClient.post('/maintenance/update-database'); | ||
|
||
// エラー処理 | ||
if (response.type === 'error') { | ||
switch (response.data.detail) { | ||
default: | ||
APIClient.showGenericError(response, 'データベースを更新できませんでした。'); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
|
||
/** | ||
* サーバーを再起動する | ||
*/ | ||
static async restartServer(): Promise<void> { | ||
|
||
// API リクエストを実行 | ||
const response = await APIClient.post('/maintenance/restart'); | ||
|
||
// エラー処理 | ||
if (response.type === 'error') { | ||
switch (response.data.detail) { | ||
default: | ||
APIClient.showGenericError(response, 'サーバーを再起動できませんでした。'); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
|
||
/** | ||
* サーバーをシャットダウンする | ||
*/ | ||
static async shutdownServer(): Promise<void> { | ||
|
||
// API リクエストを実行 | ||
const response = await APIClient.post('/maintenance/shutdown'); | ||
|
||
// エラー処理 | ||
if (response.type === 'error') { | ||
switch (response.data.detail) { | ||
default: | ||
APIClient.showGenericError(response, 'サーバーをシャットダウンできませんでした。'); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
export default Maintenance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters