Author SHA1 Message Date
alve 362de62e2f 🚪Add logout button 2024-11-28 20:26:31 +01:00
2 changed files with 7 additions and 1 deletions

No files matched your search

+1 -1
View File
@@ -66,7 +66,7 @@ def create_order(customer_id: ID, order_lines: List[OrderLineInput], is_external
product.inventory_amount -= ol.amount
product.save()
if not is_external and user.profile.balance < order_sum:
if not is_external and user.profile.balance <= order_sum:
return InsufficientFunds(
message="Du har ikke nok penger på bok.", amount_lacking=abs(order_sum - user.profile.balance)
)
+6
View File
@@ -5,6 +5,7 @@ import { NavLink } from "react-router-dom";
import styles from "./Header.module.css";
const ADMIN_URL = `${import.meta.env.VITE_API_URL}/admin/`;
const LOGOUT_URL = `${import.meta.env.VITE_API_URL}/`.replace("://", "://none:none@");
const navLinkStyles = ({ isActive }: { isActive: boolean }) => clsx(styles.navLink, { [styles.active]: isActive });
@@ -48,6 +49,11 @@ export const Header = (): JSX.Element => {
Admin
</a>
</li>
<li>
<a href={LOGOUT_URL} className={styles.navLink}>
Logg ut
</a>
</li>
</ul>
</nav>
</header>