mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-21 22:50:59 -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
|
||||
export function takeError(error: any): string {
|
||||
if (error.response) {
|
||||
const status = error.response.status;
|
||||
if (error.response.type) {
|
||||
return error.response.type;
|
||||
const type = error.response.data?.type;
|
||||
if (type) {
|
||||
return type;
|
||||
}
|
||||
|
||||
switch (status) {
|
||||
switch (error.response.status) {
|
||||
case 429:
|
||||
return "TooManyRequests";
|
||||
case 401:
|
||||
|
|
Loading…
Reference in a new issue