Better error logs in sentry
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@ import pkg from './package.json';
|
|||||||
|
|
||||||
const mode = process.env.NODE_ENV;
|
const mode = process.env.NODE_ENV;
|
||||||
const dev = mode === 'development';
|
const dev = mode === 'development';
|
||||||
const sourcemap = dev ? 'inline' : false;
|
const sourcemap = dev ? false : 'inline';
|
||||||
const legacy = !!process.env.SAPPER_LEGACY_BUILD;
|
const legacy = !!process.env.SAPPER_LEGACY_BUILD;
|
||||||
|
|
||||||
const onwarn = (warning, onwarn) => {
|
const onwarn = (warning, onwarn) => {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { derived } from 'svelte/store';
|
import { derived } from 'svelte/store';
|
||||||
import { stores, goto } from '@sapper/app';
|
import { stores, goto } from '@sapper/app';
|
||||||
|
import * as Sentry from '@sentry/browser';
|
||||||
import { Firework } from 'svelte-loading-spinners';
|
import { Firework } from 'svelte-loading-spinners';
|
||||||
import Tailwindcss from '../components/Tailwindcss.svelte';
|
import Tailwindcss from '../components/Tailwindcss.svelte';
|
||||||
import Navigation from '../components/Navigation/index.svelte';
|
import Navigation from '../components/Navigation/index.svelte';
|
||||||
@@ -72,6 +73,8 @@
|
|||||||
|
|
||||||
profile.set(data[0]);
|
profile.set(data[0]);
|
||||||
|
|
||||||
|
// Set user in sentry
|
||||||
|
Sentry.setUser($profile);
|
||||||
// If user coming to login page, then
|
// If user coming to login page, then
|
||||||
if (path.includes('login') || path.includes('signup')) {
|
if (path.includes('login') || path.includes('signup')) {
|
||||||
goto('/profile/' + $profile.id);
|
goto('/profile/' + $profile.id);
|
||||||
@@ -85,6 +88,9 @@
|
|||||||
console.log(`profileData`, profileData);
|
console.log(`profileData`, profileData);
|
||||||
profile.set(profileData);
|
profile.set(profileData);
|
||||||
|
|
||||||
|
// Set user in sentry
|
||||||
|
Sentry.setUser($profile);
|
||||||
|
|
||||||
// If user coming to login page, then
|
// If user coming to login page, then
|
||||||
if (path.includes('login') || path.includes('signup')) {
|
if (path.includes('login') || path.includes('signup')) {
|
||||||
goto('/profile/' + $profile.id);
|
goto('/profile/' + $profile.id);
|
||||||
@@ -105,8 +111,7 @@
|
|||||||
|
|
||||||
const _isMvpUser = localStorage.getItem('mvp');
|
const _isMvpUser = localStorage.getItem('mvp');
|
||||||
|
|
||||||
console.log('mounting layout', isMvpUser, path, _isMvpUser);
|
if (_isMvpUser || window.location.search.includes('mvp')) {
|
||||||
if (isMvpUser || window.location.search.includes('mvp')) {
|
|
||||||
localStorage.setItem('mvp', 'true');
|
localStorage.setItem('mvp', 'true');
|
||||||
allowUser = true;
|
allowUser = true;
|
||||||
} else if (!_isMvpUser) {
|
} else if (!_isMvpUser) {
|
||||||
@@ -122,7 +127,7 @@
|
|||||||
if (config.isDev) {
|
if (config.isDev) {
|
||||||
handleAuthChange(event, session);
|
handleAuthChange(event, session);
|
||||||
}
|
}
|
||||||
|
console.log(`event`, event);
|
||||||
if (event === 'SIGNED_IN') {
|
if (event === 'SIGNED_IN') {
|
||||||
$user.fetchingUser = true;
|
$user.fetchingUser = true;
|
||||||
getProfile();
|
getProfile();
|
||||||
|
|||||||
@@ -55,6 +55,57 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleAttendanceChange(e, student, lesson) {
|
||||||
|
if (isStudent) return;
|
||||||
|
|
||||||
|
const attendanceItem = $attendance[student.id]
|
||||||
|
? $attendance[student.id][lesson.id] || {}
|
||||||
|
: {};
|
||||||
|
|
||||||
|
if (attendanceItem.id) {
|
||||||
|
$snackbarStore.open = true;
|
||||||
|
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
|
||||||
|
$snackbarStore.message =
|
||||||
|
"Something isn't right. Please reload and take attendance again";
|
||||||
|
console.error(`Attendance Id Missing`, courseId, student.id, lesson.id);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
id: attendanceItem.id,
|
||||||
|
student_id: student.id,
|
||||||
|
is_present: e.target.checked,
|
||||||
|
lesson_id: lesson.id,
|
||||||
|
course_id: courseId,
|
||||||
|
};
|
||||||
|
|
||||||
|
takeAttendance(data).then((res) => {
|
||||||
|
if (res.error) {
|
||||||
|
console.error(`res.error`, res.error);
|
||||||
|
$snackbarStore.open = true;
|
||||||
|
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
|
||||||
|
$snackbarStore.message = "Something isn't right.";
|
||||||
|
} else {
|
||||||
|
console.log('res', JSON.stringify(res));
|
||||||
|
const { id, is_present } = res.data[0];
|
||||||
|
if ($attendance[student.id]) {
|
||||||
|
$attendance[student.id][lesson.id] = {
|
||||||
|
id,
|
||||||
|
is_present,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
$attendance[student.id] = {
|
||||||
|
[lesson.id]: {
|
||||||
|
id,
|
||||||
|
is_present,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if ($course.id) {
|
if ($course.id) {
|
||||||
if (!Object.keys($attendance).length) {
|
if (!Object.keys($attendance).length) {
|
||||||
@@ -105,7 +156,7 @@
|
|||||||
<div class="text-sm">
|
<div class="text-sm">
|
||||||
<p class="font-semibold">{student.profile.fullname}</p>
|
<p class="font-semibold">{student.profile.fullname}</p>
|
||||||
{#if student.assigned_student_id}
|
{#if student.assigned_student_id}
|
||||||
<p>#{student.assigned_student_id}</p>
|
<p>#{student.assigned_student_id}</p>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -120,36 +171,7 @@
|
|||||||
? $attendance[student.id][lesson.id].is_present
|
? $attendance[student.id][lesson.id].is_present
|
||||||
: false
|
: false
|
||||||
: false}
|
: false}
|
||||||
on:change={(e) => {
|
on:change={(e) => handleAttendanceChange(e, student, lesson)}
|
||||||
if (isStudent) return;
|
|
||||||
|
|
||||||
const attendanceItem = $attendance[student.id]
|
|
||||||
? $attendance[student.id][lesson.id] || {}
|
|
||||||
: {};
|
|
||||||
const data = {
|
|
||||||
id: attendanceItem.id,
|
|
||||||
student_id: student.id,
|
|
||||||
is_present: e.target.checked,
|
|
||||||
lesson_id: lesson.id,
|
|
||||||
course_id: courseId,
|
|
||||||
};
|
|
||||||
|
|
||||||
takeAttendance(data).then((res) => {
|
|
||||||
if (res.error) {
|
|
||||||
console.error(`res.error`, res.error);
|
|
||||||
$snackbarStore.open = true;
|
|
||||||
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
|
|
||||||
$snackbarStore.message = "Something isn't right.";
|
|
||||||
} else {
|
|
||||||
console.log('res', res);
|
|
||||||
const { id, is_present } = res.data[0];
|
|
||||||
$attendance[student.id][lesson.id] = {
|
|
||||||
id,
|
|
||||||
is_present,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
Reference in New Issue
Block a user