error page
This commit is contained in:
parent
e4280092f9
commit
d96a7bee26
|
@ -5,9 +5,7 @@ import config from "../config";
|
|||
const kratos = new PublicApi(new Configuration({ basePath: config.kratos.public }));
|
||||
|
||||
export async function getServerSideProps(context) {
|
||||
const error = req.query.error;
|
||||
|
||||
console.log("error", error);
|
||||
const error = context.query.error;
|
||||
|
||||
// No error was send, redirecting back to home.
|
||||
if (!error || typeof error !== "string") {
|
||||
|
@ -19,13 +17,10 @@ export async function getServerSideProps(context) {
|
|||
try {
|
||||
const { status, data } = await kratos.getSelfServiceError(error);
|
||||
|
||||
console.log("data", data);
|
||||
|
||||
if ("errors" in data) return { props: { errors: data.errors } };
|
||||
|
||||
throw new Error(`Expected error ${error} to contain "errors" but got ${JSON.stringify(data)}`);
|
||||
} catch (error) {
|
||||
console.log(">>>>>", error);
|
||||
return { redirect: { permanent: false, destination: config.kratos.browser } };
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue