mirror of
https://github.com/hexolan/panels.git
synced 2026-03-26 20:41:15 +00:00
manifests
This commit is contained in:
@@ -6,7 +6,7 @@ import LoadingBar from '../components/LoadingBar'
|
||||
import { useAppSelector } from '../app/hooks'
|
||||
import { useGetPanelByNameQuery } from '../app/api/panels'
|
||||
import type { Panel } from '../app/types/common'
|
||||
import type { ErrorResponse } from '../app/types/api'
|
||||
import type { QueryError, ErrorResponse } from '../app/types/api'
|
||||
|
||||
export type PanelContext = {
|
||||
panel: Panel;
|
||||
@@ -63,8 +63,8 @@ function PanelLayout() {
|
||||
} else if (!data) {
|
||||
if (!error) {
|
||||
throw Error('Unknown error occured')
|
||||
} else if ('data' in error) {
|
||||
const errResponse = error.data as ErrorResponse
|
||||
} else if ((error as QueryError).data) {
|
||||
const errResponse = (error as QueryError).data as ErrorResponse
|
||||
if (errResponse.msg) {
|
||||
throw Error(errResponse.msg)
|
||||
} else {
|
||||
|
||||
@@ -7,7 +7,7 @@ import LoadingBar from './LoadingBar'
|
||||
import { User } from '../app/types/common'
|
||||
import { useAppSelector } from '../app/hooks'
|
||||
import { useGetUserByNameQuery } from '../app/api/users'
|
||||
import type { ErrorResponse } from '../app/types/api'
|
||||
import type { ErrorResponse, QueryError } from '../app/types/api'
|
||||
|
||||
export type UserContext = {
|
||||
user: User
|
||||
@@ -40,8 +40,8 @@ function UserLayout() {
|
||||
} else if (!data) {
|
||||
if (!error) {
|
||||
throw Error('Unknown error occured')
|
||||
} else if ('data' in error) {
|
||||
const errResponse = error.data as ErrorResponse
|
||||
} else if ((error as QueryError).data) {
|
||||
const errResponse = (error as QueryError).data as ErrorResponse
|
||||
if (errResponse.msg) {
|
||||
throw Error(errResponse.msg)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user