Remove some useless console.debug calls
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
e07f88277b
commit
ffac91a027
@ -178,7 +178,6 @@ const initializeCurrentUser = () => {
|
|||||||
const role = localStorage.getItem(AUTH_USER_ROLE);
|
const role = localStorage.getItem(AUTH_USER_ROLE);
|
||||||
|
|
||||||
if (userId && userEmail && accessToken && role) {
|
if (userId && userEmail && accessToken && role) {
|
||||||
console.log("Saving current user client from localstorage", role);
|
|
||||||
updateCurrentUser({
|
updateCurrentUser({
|
||||||
id: userId,
|
id: userId,
|
||||||
email: userEmail,
|
email: userEmail,
|
||||||
@ -197,19 +196,16 @@ const refreshApp = async (
|
|||||||
if (!worker) {
|
if (!worker) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
console.debug("Doing worker.skipWaiting().");
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const channel = new MessageChannel();
|
const channel = new MessageChannel();
|
||||||
|
|
||||||
channel.port1.onmessage = (event) => {
|
channel.port1.onmessage = (event) => {
|
||||||
console.debug("Done worker.skipWaiting().");
|
|
||||||
if (event.data.error) {
|
if (event.data.error) {
|
||||||
reject(event.data);
|
reject(event.data);
|
||||||
} else {
|
} else {
|
||||||
resolve(event.data);
|
resolve(event.data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
console.debug("calling skip waiting");
|
|
||||||
worker?.postMessage({ type: "skip-waiting" }, [channel.port2]);
|
worker?.postMessage({ type: "skip-waiting" }, [channel.port2]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -99,8 +99,6 @@ export default function buildCurrentUserResolver(
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
console.debug("updating current actor", data);
|
|
||||||
|
|
||||||
localCache.writeQuery({ data, query: CURRENT_ACTOR_CLIENT });
|
localCache.writeQuery({ data, query: CURRENT_ACTOR_CLIENT });
|
||||||
},
|
},
|
||||||
updateCurrentUserLocation: (
|
updateCurrentUserLocation: (
|
||||||
|
@ -16,7 +16,6 @@ export function saveActorData(obj: IPerson): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function changeIdentity(identity: IPerson): Promise<void> {
|
export async function changeIdentity(identity: IPerson): Promise<void> {
|
||||||
console.debug("Changing identity to", identity);
|
|
||||||
if (!identity.id) return;
|
if (!identity.id) return;
|
||||||
const { mutate: updateCurrentActorClient } = provideApolloClient(
|
const { mutate: updateCurrentActorClient } = provideApolloClient(
|
||||||
apolloClient
|
apolloClient
|
||||||
@ -35,21 +34,14 @@ export async function changeIdentity(identity: IPerson): Promise<void> {
|
|||||||
*/
|
*/
|
||||||
export async function initializeCurrentActor(): Promise<void> {
|
export async function initializeCurrentActor(): Promise<void> {
|
||||||
const actorId = localStorage.getItem(AUTH_USER_ACTOR_ID);
|
const actorId = localStorage.getItem(AUTH_USER_ACTOR_ID);
|
||||||
console.debug(
|
|
||||||
"initializing current actor, using actorId from localstorage",
|
|
||||||
actorId
|
|
||||||
);
|
|
||||||
|
|
||||||
const { result: identitiesResult } = provideApolloClient(apolloClient)(() =>
|
const { result: identitiesResult } = provideApolloClient(apolloClient)(() =>
|
||||||
useQuery<{ identities: IPerson[] }>(IDENTITIES)
|
useQuery<{ identities: IPerson[] }>(IDENTITIES)
|
||||||
);
|
);
|
||||||
|
|
||||||
console.debug("identitiesResult", identitiesResult);
|
|
||||||
|
|
||||||
const identities = computed(() => identitiesResult.value?.identities);
|
const identities = computed(() => identitiesResult.value?.identities);
|
||||||
|
|
||||||
watch(identities, async () => {
|
watch(identities, async () => {
|
||||||
console.debug("identities found", identities.value);
|
|
||||||
if (identities.value && identities.value.length < 1) {
|
if (identities.value && identities.value.length < 1) {
|
||||||
console.warn("Logged user has no identities!");
|
console.warn("Logged user has no identities!");
|
||||||
throw new NoIdentitiesException();
|
throw new NoIdentitiesException();
|
||||||
@ -59,10 +51,7 @@ export async function initializeCurrentActor(): Promise<void> {
|
|||||||
(identity: IPerson | undefined) => identity?.id === actorId
|
(identity: IPerson | undefined) => identity?.id === actorId
|
||||||
) || ((identities.value || [])[0] as IPerson);
|
) || ((identities.value || [])[0] as IPerson);
|
||||||
|
|
||||||
console.debug("active identity is", activeIdentity);
|
|
||||||
|
|
||||||
if (activeIdentity) {
|
if (activeIdentity) {
|
||||||
console.debug("active identity found, setting it up");
|
|
||||||
await changeIdentity(activeIdentity);
|
await changeIdentity(activeIdentity);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -374,9 +374,7 @@ onMounted(() => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
watch(loggedUser, (loggedUserValue) => {
|
watch(loggedUser, (loggedUserValue) => {
|
||||||
console.debug("Try to detect empty user settings", loggedUserValue);
|
|
||||||
if (loggedUserValue?.id && loggedUserValue?.settings === null) {
|
if (loggedUserValue?.id && loggedUserValue?.settings === null) {
|
||||||
console.debug("No user settings, pushing to onboarding assistant");
|
|
||||||
router.push({
|
router.push({
|
||||||
name: RouteName.WELCOME_SCREEN,
|
name: RouteName.WELCOME_SCREEN,
|
||||||
params: { step: "1" },
|
params: { step: "1" },
|
||||||
|
Loading…
Reference in New Issue
Block a user