v1 review pass: fixed some minor bugs
This commit is contained in:
@@ -3,6 +3,7 @@ import type { SubmitEvent } from "react";
|
||||
import { Link, useNavigate } from "react-router";
|
||||
|
||||
import { API_URL } from "../config/api.ts";
|
||||
import { deserializeAuthResponse } from "../model.ts";
|
||||
import { useAuth } from "../hooks/useAuth.ts";
|
||||
import { PageShell } from "../components/PageShell.tsx";
|
||||
|
||||
@@ -38,7 +39,7 @@ export function UserRegister() {
|
||||
const apiResponse = await res.json();
|
||||
|
||||
if (apiResponse.success) {
|
||||
login(apiResponse.data);
|
||||
login(deserializeAuthResponse(apiResponse.data));
|
||||
navigate("/");
|
||||
} else {
|
||||
setState({ status: "error", error: apiResponse.error.message });
|
||||
@@ -76,7 +77,11 @@ export function UserRegister() {
|
||||
required
|
||||
disabled={state.status === "submitting"}
|
||||
/>
|
||||
<button type="submit" className="btn-primary" disabled={state.status === "submitting"}>
|
||||
<button
|
||||
type="submit"
|
||||
className="btn-primary"
|
||||
disabled={state.status === "submitting"}
|
||||
>
|
||||
{state.status === "submitting" ? "Registering…" : "Register"}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user