style: drop redundant comments and apply formatting
Frontend now uses double quotes and semicolons. No behaviour change.
This commit is contained in:
+29
-17
@@ -1,13 +1,20 @@
|
||||
import { useState } from 'react'
|
||||
import { BrowserRouter, Link, Navigate, Outlet, Route, Routes } from 'react-router'
|
||||
import { errorMessage } from './api'
|
||||
import { AuthProvider, useAuth } from './auth/AuthContext'
|
||||
import { LoginForm } from './auth/LoginForm'
|
||||
import { RequireAuth } from './auth/RequireAuth'
|
||||
import { BookList } from './books/BookList'
|
||||
import { BookDetail } from './books/BookDetail'
|
||||
import { BookForm } from './books/BookForm'
|
||||
import { secondaryButton } from './ui'
|
||||
import { useState } from "react";
|
||||
import {
|
||||
BrowserRouter,
|
||||
Link,
|
||||
Navigate,
|
||||
Outlet,
|
||||
Route,
|
||||
Routes,
|
||||
} from "react-router";
|
||||
import { errorMessage } from "./api";
|
||||
import { AuthProvider, useAuth } from "./auth/AuthContext";
|
||||
import { LoginForm } from "./auth/LoginForm";
|
||||
import { RequireAuth } from "./auth/RequireAuth";
|
||||
import { BookList } from "./books/BookList";
|
||||
import { BookDetail } from "./books/BookDetail";
|
||||
import { BookForm } from "./books/BookForm";
|
||||
import { secondaryButton } from "./ui";
|
||||
|
||||
export function App() {
|
||||
return (
|
||||
@@ -16,7 +23,7 @@ export function App() {
|
||||
<AppRoutes />
|
||||
</AuthProvider>
|
||||
</BrowserRouter>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function AppRoutes() {
|
||||
@@ -33,12 +40,12 @@ export function AppRoutes() {
|
||||
</Route>
|
||||
<Route path="*" element={<Navigate to="/books" replace />} />
|
||||
</Routes>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function Shell() {
|
||||
const { user, logout } = useAuth()
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const { user, logout } = useAuth();
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
return (
|
||||
<div className="min-h-screen bg-slate-50 text-slate-900">
|
||||
<header className="border-b border-slate-200 bg-white">
|
||||
@@ -51,14 +58,19 @@ function Shell() {
|
||||
<button
|
||||
type="button"
|
||||
className={secondaryButton}
|
||||
onClick={() => logout().catch((err) => setError(errorMessage(err)))}
|
||||
onClick={() =>
|
||||
logout().catch((err) => setError(errorMessage(err)))
|
||||
}
|
||||
>
|
||||
Log out
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{error && (
|
||||
<p role="alert" className="mx-auto max-w-4xl px-4 pb-2 text-sm text-red-700">
|
||||
<p
|
||||
role="alert"
|
||||
className="mx-auto max-w-4xl px-4 pb-2 text-sm text-red-700"
|
||||
>
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
@@ -67,5 +79,5 @@ function Shell() {
|
||||
<Outlet />
|
||||
</main>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user