Compare commits

2 Commits

Author SHA1 Message Date
71641f61bf Merge pull request 'more auth ree' (#16) from development into main
All checks were successful
CI/CD Pipeline / Build and Push App Docker Image (push) Successful in 2m37s
CI/CD Pipeline / Build and Push PocketBase Docker Image (push) Successful in 8s
CI/CD Pipeline / Deploy to Kubernetes (push) Successful in 47s
Reviewed-on: #16
2026-03-02 22:50:26 -06:00
yohlo
1f1de2e04b more auth ree
Some checks failed
CI/CD Pipeline / Build and Push PocketBase Docker Image (push) Has been cancelled
CI/CD Pipeline / Deploy to Kubernetes (push) Has been cancelled
CI/CD Pipeline / Build and Push App Docker Image (push) Has been cancelled
2026-03-02 22:49:49 -06:00

View File

@@ -15,7 +15,7 @@ export const fetchMe = createServerFn()
const request = getRequest();
try {
const context = await getSessionContext(request, { isServerFunction: true });
const context = await getSessionContext(request);
await pbAdmin.authPromise;
const result = await pbAdmin.getPlayerByAuthId(context.userAuthId);
@@ -39,27 +39,6 @@ export const fetchMe = createServerFn()
throw error;
}
if (error instanceof Response) {
const status = error.status;
if (status === 440) {
logger.info("FetchMe: Session refresh required (440)");
throw error;
}
}
if (error?.response?.status === 440 || error?.response?.status === 401) {
const errorData = error?.response?.data;
if (errorData?.error === "SESSION_REFRESH_REQUIRED") {
logger.info("FetchMe: Session refresh required (legacy)");
throw error;
}
}
if (error?.message === "SESSION_REFRESH_REQUIRED") {
logger.info("FetchMe: Session refresh required - returning empty auth (client will handle cleanup)");
return { user: undefined, roles: [], metadata: {}, phone: undefined };
}
if (error?.message === "Unauthenticated") {
logger.info("FetchMe: No authenticated user (expected when not logged in)");
return { user: undefined, roles: [], metadata: {}, phone: undefined };