Compare commits
3
Commits
33abda997f
...
4ab3c3a135
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ab3c3a135 | ||
|
|
251eb6deb9 | ||
|
|
b7886589cb |
No files matched your search
+1
-1
@@ -35,7 +35,7 @@ FROM gcr.io/distroless/nodejs24-debian13:nonroot AS runtime
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NODE_ENV=prod
|
# ENV NODE_ENV=prod
|
||||||
|
|
||||||
COPY --from=prod-deps --chown=nonroot:nonroot /app/package.json ./package.json
|
COPY --from=prod-deps --chown=nonroot:nonroot /app/package.json ./package.json
|
||||||
COPY --from=prod-deps --chown=nonroot:nonroot /app/node_modules ./node_modules
|
COPY --from=prod-deps --chown=nonroot:nonroot /app/node_modules ./node_modules
|
||||||
|
|||||||
+15
-1
@@ -1,4 +1,5 @@
|
|||||||
import { API_BASE_URL, getAuthUserId } from '../config';
|
import { API_BASE_URL, getAuthUserId } from '../config';
|
||||||
|
import { acquireAccessToken } from './auth/token-provider';
|
||||||
|
|
||||||
export class ApiError extends Error {
|
export class ApiError extends Error {
|
||||||
readonly data: unknown;
|
readonly data: unknown;
|
||||||
@@ -42,6 +43,14 @@ async function readResponseBody(response: Response): Promise<unknown> {
|
|||||||
return text ? text : null;
|
return text ? text : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function resolveAccessToken(): Promise<string | null> {
|
||||||
|
try {
|
||||||
|
return await acquireAccessToken();
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export async function apiFetch<T>(
|
export async function apiFetch<T>(
|
||||||
path: string,
|
path: string,
|
||||||
options: ApiFetchOptions = {},
|
options: ApiFetchOptions = {},
|
||||||
@@ -54,8 +63,13 @@ export async function apiFetch<T>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (auth !== 'none' && !requestHeaders.has('Authorization')) {
|
if (auth !== 'none' && !requestHeaders.has('Authorization')) {
|
||||||
|
const accessToken = auth === 'dev' ? null : await resolveAccessToken();
|
||||||
|
if (accessToken) {
|
||||||
|
requestHeaders.set('Authorization', `Bearer ${accessToken}`);
|
||||||
|
}
|
||||||
|
|
||||||
const authUserId = getAuthUserId();
|
const authUserId = getAuthUserId();
|
||||||
if (authUserId) {
|
if (!accessToken && authUserId) {
|
||||||
requestHeaders.set('x-auth-user-id', authUserId);
|
requestHeaders.set('x-auth-user-id', authUserId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1073,7 +1073,7 @@ export default function AuctionPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<aside className="hidden xl:block">
|
<aside className="hidden xl:block">
|
||||||
<ChatPanel matchId={auctionState.matchId} />
|
<ChatPanel />
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
@@ -1231,7 +1231,7 @@ function PoolListItem({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ChatPanel({ matchId: _matchId }: { matchId: string }) {
|
function ChatPanel() {
|
||||||
return (
|
return (
|
||||||
<div className="border border-base-content/10 bg-base-100 sticky top-4 h-[calc(100vh-2rem)] flex flex-col">
|
<div className="border border-base-content/10 bg-base-100 sticky top-4 h-[calc(100vh-2rem)] flex flex-col">
|
||||||
<div className="border-b border-base-content/10 px-3 py-2.5 flex items-center justify-between">
|
<div className="border-b border-base-content/10 px-3 py-2.5 flex items-center justify-between">
|
||||||
|
|||||||
Reference in new issue
Block a user