-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from ASM-Studios/mra/evol-about-ids
evol(about): add ids to payload
- Loading branch information
Showing
11 changed files
with
187 additions
and
48 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
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
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
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,23 @@ | ||
import { createContext, useState, ReactNode } from 'react'; | ||
|
||
interface Error { | ||
error: string; | ||
errorDescription: string; | ||
} | ||
|
||
export interface ErrorContextType { | ||
error: Error | null; | ||
setError: (error: Error | null) => void; | ||
} | ||
|
||
export const ErrorContext = createContext<ErrorContextType | undefined>(undefined); | ||
|
||
export const ErrorProvider = ({ children }: { children: ReactNode }) => { | ||
const [error, setError] = useState<Error | null>(null); | ||
|
||
return ( | ||
<ErrorContext.Provider value={{ error, setError }}> | ||
{children} | ||
</ErrorContext.Provider> | ||
); | ||
} |
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,28 @@ | ||
import { Result } from 'antd'; | ||
import LinkButton from "@/Components/LinkButton"; | ||
import React from 'react'; | ||
import {ErrorContext} from "@/Context/Scopes/ErrorContext"; | ||
import { useError } from "@/Context/ContextHooks"; | ||
import { useAuth } from "@/Context/ContextHooks"; | ||
|
||
const CustomError: () => React.ReactElement = () => { | ||
const { error } = useError(); | ||
const { isAuthenticated } = useAuth(); | ||
|
||
return ( | ||
<Result | ||
status="error" | ||
title={`${error?.error ?? 'Error'}`} | ||
subTitle={`${error?.errorDescription ?? 'An error occurred'}`} | ||
extra={ | ||
<LinkButton | ||
text={isAuthenticated ? "Back to Dashboard" : "Back Home"} | ||
url={isAuthenticated ? "/dashboard" : "/"} | ||
/> | ||
} | ||
style={{ zIndex: 1, position: 'relative' }} | ||
/> | ||
); | ||
}; | ||
|
||
export default CustomError; |
Oops, something went wrong.