mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-22 07:00:58 -05:00
fix: actually resolve the error from requests
This commit is contained in:
parent
12b9716043
commit
67c8418c31
1 changed files with 4 additions and 4 deletions
|
@ -7,12 +7,12 @@ import { Children } from "../../types/Preact";
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
export function takeError(error: any): string {
|
export function takeError(error: any): string {
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
const status = error.response.status;
|
const type = error.response.data?.type;
|
||||||
if (error.response.type) {
|
if (type) {
|
||||||
return error.response.type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (status) {
|
switch (error.response.status) {
|
||||||
case 429:
|
case 429:
|
||||||
return "TooManyRequests";
|
return "TooManyRequests";
|
||||||
case 401:
|
case 401:
|
||||||
|
|
Loading…
Reference in a new issue