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 dev = mode === 'development';
|
||||
const sourcemap = dev ? 'inline' : false;
|
||||
const sourcemap = dev ? false : 'inline';
|
||||
const legacy = !!process.env.SAPPER_LEGACY_BUILD;
|
||||
|
||||
const onwarn = (warning, onwarn) => {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { derived } from 'svelte/store';
|
||||
import { stores, goto } from '@sapper/app';
|
||||
import * as Sentry from '@sentry/browser';
|
||||
import { Firework } from 'svelte-loading-spinners';
|
||||
import Tailwindcss from '../components/Tailwindcss.svelte';
|
||||
import Navigation from '../components/Navigation/index.svelte';
|
||||
@@ -72,6 +73,8 @@
|
||||
|
||||
profile.set(data[0]);
|
||||
|
||||
// Set user in sentry
|
||||
Sentry.setUser($profile);
|
||||
// If user coming to login page, then
|
||||
if (path.includes('login') || path.includes('signup')) {
|
||||
goto('/profile/' + $profile.id);
|
||||
@@ -85,6 +88,9 @@
|
||||
console.log(`profileData`, profileData);
|
||||
profile.set(profileData);
|
||||
|
||||
// Set user in sentry
|
||||
Sentry.setUser($profile);
|
||||
|
||||
// If user coming to login page, then
|
||||
if (path.includes('login') || path.includes('signup')) {
|
||||
goto('/profile/' + $profile.id);
|
||||
@@ -105,8 +111,7 @@
|
||||
|
||||
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');
|
||||
allowUser = true;
|
||||
} else if (!_isMvpUser) {
|
||||
@@ -122,7 +127,7 @@
|
||||
if (config.isDev) {
|
||||
handleAuthChange(event, session);
|
||||
}
|
||||
|
||||
console.log(`event`, event);
|
||||
if (event === 'SIGNED_IN') {
|
||||
$user.fetchingUser = true;
|
||||
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 () => {
|
||||
if ($course.id) {
|
||||
if (!Object.keys($attendance).length) {
|
||||
@@ -120,36 +171,7 @@
|
||||
? $attendance[student.id][lesson.id].is_present
|
||||
: false
|
||||
: false}
|
||||
on:change={(e) => {
|
||||
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,
|
||||
};
|
||||
}
|
||||
});
|
||||
}}
|
||||
on:change={(e) => handleAttendanceChange(e, student, lesson)}
|
||||
/>
|
||||
</p>
|
||||
{/each}
|
||||
|
||||
Reference in New Issue
Block a user