fix: 文件上传204无内容
This commit is contained in:
@@ -300,18 +300,28 @@ export async function request(options: OptionsType): Promise<ResultType> {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
function stateCode(res: Response) {
|
function stateCode(res: Response) {
|
||||||
|
// 网络异常
|
||||||
if (res.status === 500) {
|
if (res.status === 500) {
|
||||||
return {
|
return {
|
||||||
code: RESULT_CODE_ERROR,
|
code: RESULT_CODE_ERROR,
|
||||||
msg: RESULT_MSG_SERVER_ERROR,
|
msg: RESULT_MSG_SERVER_ERROR,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// 上传文件成功无内容返回
|
||||||
|
if (res.status === 204 && res.statusText === 'No Content') {
|
||||||
|
return {
|
||||||
|
code: RESULT_CODE_SUCCESS,
|
||||||
|
msg: RESULT_MSG_SUCCESS,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// 地址找不到
|
||||||
if (res.status === 404) {
|
if (res.status === 404) {
|
||||||
return {
|
return {
|
||||||
code: RESULT_CODE_ERROR,
|
code: RESULT_CODE_ERROR,
|
||||||
msg: RESULT_MSG_URL_NOTFOUND,
|
msg: RESULT_MSG_URL_NOTFOUND,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// 身份授权
|
||||||
if (res.status === 401) {
|
if (res.status === 401) {
|
||||||
removeToken();
|
removeToken();
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
|||||||
Reference in New Issue
Block a user