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:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Create .env from example
|
||||
run: cp ../.env.example .env
|
||||
run: cp ../.env.example ../.env
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Create .env from example
|
||||
run: cp ../.env.example .env
|
||||
run: cp ../.env.example ../.env
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
|
||||
@@ -3,7 +3,7 @@ import Logo from "../components/Logo";
|
||||
export default function Home() {
|
||||
return (
|
||||
<div>
|
||||
<Logo/>
|
||||
<Logo />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { InfoIcon } from "@phosphor-icons/react";
|
||||
import axios from "axios";
|
||||
import { useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
@@ -48,9 +49,11 @@ export default function Register() {
|
||||
navigate("/verify-email");
|
||||
} catch (err) {
|
||||
console.error("Registration error:", err);
|
||||
setApiError(
|
||||
err.response?.data?.message || "Registration failed. Please try again.",
|
||||
);
|
||||
let message = "Registration failed. Please try again.";
|
||||
if (axios.isAxiosError(err)) {
|
||||
message = err.response?.data?.message || message;
|
||||
}
|
||||
setApiError(message);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user