mirror of
https://github.com/ramvignesh-b/pi-ku.git
synced 2026-05-04 08:56:52 +00:00
feat: improve error handling in registration
This commit is contained in:
@@ -16,7 +16,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Create .env from example
|
- name: Create .env from example
|
||||||
run: cp ../.env.example .env
|
run: cp ../.env.example ../.env
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Create .env from example
|
- name: Create .env from example
|
||||||
run: cp ../.env.example .env
|
run: cp ../.env.example ../.env
|
||||||
- name: Install uv
|
- name: Install uv
|
||||||
uses: astral-sh/setup-uv@v5
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Logo from "../components/Logo";
|
|||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Logo/>
|
<Logo />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { InfoIcon } from "@phosphor-icons/react";
|
import { InfoIcon } from "@phosphor-icons/react";
|
||||||
|
import axios from "axios";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
@@ -48,9 +49,11 @@ export default function Register() {
|
|||||||
navigate("/verify-email");
|
navigate("/verify-email");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Registration error:", err);
|
console.error("Registration error:", err);
|
||||||
setApiError(
|
let message = "Registration failed. Please try again.";
|
||||||
err.response?.data?.message || "Registration failed. Please try again.",
|
if (axios.isAxiosError(err)) {
|
||||||
);
|
message = err.response?.data?.message || message;
|
||||||
|
}
|
||||||
|
setApiError(message);
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user