Merge pull request #847 from buster-so/nate/many-updates

Nate/many updates
This commit is contained in:
Nate Kelley 2025-09-10 16:22:15 -06:00 committed by GitHub
commit 42ea557a4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 13 deletions

View File

@ -95,10 +95,11 @@ jobs:
NODE_ENV: production
- name: Purge Cloudflare Cache
uses: nathanvaughn/actions-cloudflare-purge@master
with:
cf_zone: ${{ secrets.CLOUDFLARE_ZONE_ID }}
cf_auth: ${{ secrets.CLOUDFLARE_API_TOKEN }}
run: |
curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE_ID }}/purge_cache" \
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
- name: Get commit info
id: commit

View File

@ -14,7 +14,11 @@ export const getSupabaseSession = async () => {
: await supabase.auth.getSession(); //10 - 15ms locally, maybe consider getting it from the cookie instead. console the supabase object it had it there.
if ((!sessionData?.session || sessionError) && !isServer) {
throw new Error('No session data found');
return {
accessToken: '',
isExpired: true,
expiresAt: 0,
};
}
const isExpired = isTokenExpired(sessionData.session?.expires_at);

View File

@ -16,17 +16,22 @@ export const Route = createFileRoute('/app')({
ssr: true,
beforeLoad: async () => {
console.log('beforeLoad app route');
const { isExpired, accessToken = '' } = await getSupabaseSession();
console.log('beforeLoad app route done');
try {
const { isExpired, accessToken = '' } = await getSupabaseSession();
console.log('beforeLoad app route done');
if (isExpired || !accessToken) {
console.error('Access token is expired or not found');
if (isExpired || !accessToken) {
console.error('Access token is expired or not found');
throw redirect({ to: '/auth/login', replace: true });
}
return {
accessToken,
};
} catch (error) {
console.error('Error in app route beforeLoad:', error);
throw redirect({ to: '/auth/login', replace: true });
}
return {
accessToken,
};
},
loader: async ({ context }) => {
const { queryClient, accessToken } = context;