feat: Enhance server security and performance by adding helmet for security headers, implementing rate limiting, and centralizing error handling; update frontend API calls to use a dedicated api module for consistency
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 4m37s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 4m37s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import axios from 'axios';
|
||||
import api from '../lib/api.js';
|
||||
|
||||
function LockBanner({ resource, className = '' }) {
|
||||
const [status, setStatus] = useState({ locked: false });
|
||||
@@ -15,7 +15,7 @@ function LockBanner({ resource, className = '' }) {
|
||||
|
||||
const fetchStatus = async () => {
|
||||
try {
|
||||
const res = await axios.get(`/api/locks/${resource}`);
|
||||
const res = await api.get(`/locks/${resource}`);
|
||||
setStatus(res.data || { locked: false });
|
||||
} catch {
|
||||
// ignore
|
||||
@@ -31,7 +31,7 @@ function LockBanner({ resource, className = '' }) {
|
||||
const acquireOrRefresh = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await axios.post(`/api/locks/${resource}`, { owner, ttlSeconds: 180 });
|
||||
const res = await api.post(`/locks/${resource}`, { owner, ttlSeconds: 180 });
|
||||
setStatus(res.data || { locked: true, owner, expiresAt: Date.now() + 180_000 });
|
||||
} catch {
|
||||
// ignore
|
||||
@@ -43,7 +43,7 @@ function LockBanner({ resource, className = '' }) {
|
||||
const release = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
await axios.delete(`/api/locks/${resource}`);
|
||||
await api.delete(`/locks/${resource}`);
|
||||
setStatus({ locked: false });
|
||||
} catch {
|
||||
// ignore
|
||||
|
||||
Reference in New Issue
Block a user