Public Access
refactor(auth): send login token through apiFetch
All authenticated calls now use apiFetch, and only utils/auth.js touches the stored token. The cookie login can then change these two files instead of every page.
This commit is contained in:
1 parent
085fcf15a4
commit
5ff8d48c53
18 files changed
+127
-70
No files matched your search
@@ -13,6 +13,7 @@ import {cn} from '@/lib/utils';
|
||||
import {STATUS_META} from './GameStatusBadge.jsx';
|
||||
import {GAME_PRIORITIES, GAME_STATUSES, NO_PRIORITY, saveBacklogEntry, toBacklogRequest} from '../utils/backlog.js';
|
||||
import useSessionExpired from '../hooks/useSessionExpired.js';
|
||||
import {getToken} from '../utils/auth.js';
|
||||
|
||||
const NOTES_MAX = 2000;
|
||||
|
||||
@@ -41,8 +42,7 @@ export default function BacklogCard({game, onSaved}) {
|
||||
const set = (field) => (value) => setForm((f) => ({...f, [field]: value}));
|
||||
|
||||
const save = async () => {
|
||||
const token = localStorage.getItem('tbp_jwt');
|
||||
if (!token) {
|
||||
if (!getToken()) {
|
||||
navigate('/login');
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user