bugfixing
This commit is contained in:
parent
087231c600
commit
64d04ed2f2
@ -25,9 +25,9 @@ export const handle = async ({ event, resolve }) => {
|
|||||||
const userRegion = event?.locals?.region?.split("::")?.at(0)?.split("::")?.at(0) || '';
|
const userRegion = event?.locals?.region?.split("::")?.at(0)?.split("::")?.at(0) || '';
|
||||||
|
|
||||||
// Set a default API URL
|
// Set a default API URL
|
||||||
let pbUrl = import.meta.env.VITE_EU_POCKETBASE_URL;
|
let pbUrl;
|
||||||
let apiURL = import.meta.env.VITE_EU_API_URL;
|
let apiURL;
|
||||||
let fastifyURL = import.meta.env.VITE_EU_FASTIFY_URL;
|
let fastifyURL;
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
||||||
|
|
||||||
|
|
||||||
@ -47,20 +47,19 @@ export const handle = async ({ event, resolve }) => {
|
|||||||
event.locals.pb = new PocketBase(pbUrl);
|
event.locals.pb = new PocketBase(pbUrl);
|
||||||
event.locals.pb.authStore.loadFromCookie(event?.request?.headers?.get('cookie') || '');
|
event.locals.pb.authStore.loadFromCookie(event?.request?.headers?.get('cookie') || '');
|
||||||
|
|
||||||
|
event.locals.apiURL = apiURL;
|
||||||
|
event.locals.fastifyURL = fastifyURL;
|
||||||
|
event.locals.apiKey = apiKey;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (event?.locals?.pb?.authStore?.isValid) {
|
if (event?.locals?.pb?.authStore?.isValid) {
|
||||||
await event?.locals?.pb?.collection('users')?.authRefresh();
|
await event?.locals?.pb?.collection('users')?.authRefresh();
|
||||||
event.locals.user = serializeNonPOJOs(event?.locals?.pb?.authStore?.model);
|
event.locals.user = serializeNonPOJOs(event?.locals?.pb?.authStore?.model);
|
||||||
event.locals.apiURL = apiURL;
|
|
||||||
event.locals.fastifyURL = fastifyURL;
|
|
||||||
event.locals.apiKey = apiKey;
|
|
||||||
}
|
}
|
||||||
} catch(_) {
|
} catch(_) {
|
||||||
event?.locals?.pb?.authStore?.clear();
|
event?.locals?.pb?.authStore?.clear();
|
||||||
event.locals.user = undefined;
|
event.locals.user = undefined;
|
||||||
event.locals.apiURL = apiURL;
|
|
||||||
event.locals.fastifyURL = fastifyURL;
|
|
||||||
event.locals.apiKey = apiKey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -117,8 +117,7 @@ async function fetchCommunitySentiment(pb, ticker, cookies)
|
|||||||
|
|
||||||
export const load = async ({ params, locals, cookies, setHeaders}) => {
|
export const load = async ({ params, locals, cookies, setHeaders}) => {
|
||||||
|
|
||||||
|
const userRegion = locals?.region?.split("::")[0];
|
||||||
const userRegion = locals?.region?.split("::")[0];
|
|
||||||
|
|
||||||
let apiURL = locals?.apiURL;
|
let apiURL = locals?.apiURL;
|
||||||
let fastifyURL = locals?.fastifyURL;
|
let fastifyURL = locals?.fastifyURL;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user