Merge pull request #436 from Discours/feature/glitchtip
error collector connected
This commit is contained in:
commit
a024080661
2
.github/workflows/node-ci.yml
vendored
2
.github/workflows/node-ci.yml
vendored
|
@ -13,7 +13,7 @@ jobs:
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Check types
|
- name: Check types
|
||||||
run: npm run typecheck
|
run: npm run check:types
|
||||||
|
|
||||||
- name: Lint with Biome
|
- name: Lint with Biome
|
||||||
run: npm run check:code
|
run: npm run check:code
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
"lint:styles:fix": "stylelint **/*.{scss,css} --fix",
|
"lint:styles:fix": "stylelint **/*.{scss,css} --fix",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"start": "vite",
|
"start": "vite",
|
||||||
"typecheck": "tsc --noEmit",
|
"check:types": "tsc --noEmit",
|
||||||
"typecheck:watch": "tsc --noEmit --watch"
|
"check:types:watch": "tsc --noEmit --watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"form-data": "4.0.0",
|
"form-data": "4.0.0",
|
||||||
|
|
|
@ -97,7 +97,12 @@ export const LoginForm = () => {
|
||||||
const { errors } = await signIn({ email: email(), password: password() })
|
const { errors } = await signIn({ email: email(), password: password() })
|
||||||
console.error('[signIn errors]', errors)
|
console.error('[signIn errors]', errors)
|
||||||
if (errors?.length > 0) {
|
if (errors?.length > 0) {
|
||||||
if (errors.some((error) => error.message.includes('bad user credentials'))) {
|
if (
|
||||||
|
errors.some(
|
||||||
|
(error) =>
|
||||||
|
error.message.includes('bad user credentials') || error.message.includes('user not found'),
|
||||||
|
)
|
||||||
|
) {
|
||||||
setValidationErrors((prev) => ({
|
setValidationErrors((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
password: t('Something went wrong, check email and password'),
|
password: t('Something went wrong, check email and password'),
|
||||||
|
|
|
@ -61,7 +61,12 @@ export const SendResetLinkForm = () => {
|
||||||
redirect_uri: window.location.origin,
|
redirect_uri: window.location.origin,
|
||||||
})
|
})
|
||||||
console.debug('[SendResetLinkForm] authorizer response:', data)
|
console.debug('[SendResetLinkForm] authorizer response:', data)
|
||||||
if (errors?.some((error) => error.message.includes('bad user credentials'))) {
|
if (
|
||||||
|
errors?.some(
|
||||||
|
(error) =>
|
||||||
|
error.message.includes('bad user credentials') || error.message.includes('user not found'),
|
||||||
|
)
|
||||||
|
) {
|
||||||
setIsUserNotFound(true)
|
setIsUserNotFound(true)
|
||||||
}
|
}
|
||||||
if (data.message) setMessage(data.message)
|
if (data.message) setMessage(data.message)
|
||||||
|
|
|
@ -57,6 +57,7 @@ export const HeaderAuth = (props: Props) => {
|
||||||
toggleEditorPanel()
|
toggleEditorPanel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: use or remove
|
||||||
const handleSaveClick = () => {
|
const handleSaveClick = () => {
|
||||||
const hasTopics = form.selectedTopics?.length > 0
|
const hasTopics = form.selectedTopics?.length > 0
|
||||||
if (hasTopics) {
|
if (hasTopics) {
|
||||||
|
@ -110,7 +111,13 @@ export const HeaderAuth = (props: Props) => {
|
||||||
<div class={clsx('col-auto col-lg-7', styles.usernav)}>
|
<div class={clsx('col-auto col-lg-7', styles.usernav)}>
|
||||||
<div class={styles.userControl}>
|
<div class={styles.userControl}>
|
||||||
<Show when={isCreatePostButtonVisible() && author()?.id}>
|
<Show when={isCreatePostButtonVisible() && author()?.id}>
|
||||||
<div class={clsx(styles.userControlItem, styles.userControlItemVerbose)}>
|
<div
|
||||||
|
class={clsx(
|
||||||
|
styles.userControlItem,
|
||||||
|
styles.userControlItemVerbose,
|
||||||
|
// styles.userControlItemCreate,
|
||||||
|
)}
|
||||||
|
>
|
||||||
<a href={getPagePath(router, 'create')}>
|
<a href={getPagePath(router, 'create')}>
|
||||||
<span class={styles.textLabel}>{t('Create post')}</span>
|
<span class={styles.textLabel}>{t('Create post')}</span>
|
||||||
<Icon name="pencil-outline" class={styles.icon} />
|
<Icon name="pencil-outline" class={styles.icon} />
|
||||||
|
@ -217,8 +224,14 @@ export const HeaderAuth = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
||||||
<Show when={isCreatePostButtonVisible() && !author()?.id}>
|
<Show when={isCreatePostButtonVisible() && !!author()?.id}>
|
||||||
<div class={clsx(styles.userControlItem, styles.userControlItemVerbose)}>
|
<div
|
||||||
|
class={clsx(
|
||||||
|
styles.userControlItem,
|
||||||
|
styles.userControlItemVerbose,
|
||||||
|
// styles.userControlItemCreate,
|
||||||
|
)}
|
||||||
|
>
|
||||||
<a href={getPagePath(router, 'create')}>
|
<a href={getPagePath(router, 'create')}>
|
||||||
<span class={styles.textLabel}>{t('Create post')}</span>
|
<span class={styles.textLabel}>{t('Create post')}</span>
|
||||||
<Icon name="pencil-outline" class={styles.icon} />
|
<Icon name="pencil-outline" class={styles.icon} />
|
||||||
|
@ -241,10 +254,13 @@ export const HeaderAuth = (props: Props) => {
|
||||||
</Show>
|
</Show>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Show
|
<Show when={!isSaveButtonVisible()}>
|
||||||
when={isSaveButtonVisible()}
|
<div
|
||||||
fallback={
|
class={clsx(
|
||||||
<div class={clsx(styles.userControlItem)}>
|
styles.userControlItem,
|
||||||
|
// styles.userControlItemInbox
|
||||||
|
)}
|
||||||
|
>
|
||||||
<a href={getPagePath(router, 'inbox')}>
|
<a href={getPagePath(router, 'inbox')}>
|
||||||
<div classList={{ entered: page().path === '/inbox' }}>
|
<div classList={{ entered: page().path === '/inbox' }}>
|
||||||
<Icon name="inbox-white" class={styles.icon} />
|
<Icon name="inbox-white" class={styles.icon} />
|
||||||
|
@ -252,15 +268,6 @@ export const HeaderAuth = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
}
|
|
||||||
>
|
|
||||||
<div class={clsx(styles.userControlItem, styles.userControlItemVerbose)}>
|
|
||||||
<button onClick={handleSaveClick}>
|
|
||||||
<span class={styles.textLabel}>{t('Save')}</span>
|
|
||||||
<Icon name="save" class={styles.icon} />
|
|
||||||
<Icon name="save" class={clsx(styles.icon, styles.iconHover)} />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</Show>
|
</Show>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -48,7 +48,7 @@ export const TopicBadge = (props: Props) => {
|
||||||
lang() === 'en' ? capitalize(props.topic.slug.replaceAll('-', ' ')) : props.topic.title
|
lang() === 'en' ? capitalize(props.topic.slug.replaceAll('-', ' ')) : props.topic.title
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={clsx(styles.TopicBadge, { [styles.TopicBadgeSubscriptionsMode]: props.subscriptionsMode })}>
|
<div class={clsx(styles.TopicBadge, props.subscriptionsMode)}>
|
||||||
<div class={styles.content}>
|
<div class={styles.content}>
|
||||||
<div class={styles.basicInfo}>
|
<div class={styles.basicInfo}>
|
||||||
<Show when={props.subscriptionsMode}>
|
<Show when={props.subscriptionsMode}>
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
import { gql } from '@urql/core'
|
|
||||||
|
|
||||||
export default gql`
|
|
||||||
query MySubscriptionsQuery {
|
|
||||||
get_my_followed {
|
|
||||||
topics {
|
|
||||||
id
|
|
||||||
title
|
|
||||||
body
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
authors {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
slug
|
|
||||||
pic
|
|
||||||
created_at
|
|
||||||
}
|
|
||||||
communities {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
slug
|
|
||||||
pic
|
|
||||||
created_at
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { PageContextBuiltInClientWithClientRouting } from 'vike/types'
|
import type { PageContextBuiltInClientWithClientRouting } from 'vike/types'
|
||||||
import type { PageContext } from './types'
|
import type { PageContext } from './types'
|
||||||
|
|
||||||
// import * as Sentry from '@sentry/browser'
|
import { init as SentryInit, replayIntegration } from '@sentry/browser'
|
||||||
import i18next from 'i18next'
|
import i18next from 'i18next'
|
||||||
import HttpApi from 'i18next-http-backend'
|
import HttpApi from 'i18next-http-backend'
|
||||||
import ICU from 'i18next-icu'
|
import ICU from 'i18next-icu'
|
||||||
|
@ -9,7 +9,7 @@ import { hydrate } from 'solid-js/web'
|
||||||
|
|
||||||
import { App } from '../components/App'
|
import { App } from '../components/App'
|
||||||
import { initRouter } from '../stores/router'
|
import { initRouter } from '../stores/router'
|
||||||
// import { SENTRY_DSN } from '../utils/config'
|
import { GLITCHTIP_DSN } from '../utils/config'
|
||||||
import { resolveHydrationPromise } from '../utils/hydrationPromise'
|
import { resolveHydrationPromise } from '../utils/hydrationPromise'
|
||||||
|
|
||||||
let layoutReady = false
|
let layoutReady = false
|
||||||
|
@ -20,13 +20,16 @@ export const render = async (pageContext: PageContextBuiltInClientWithClientRout
|
||||||
const { pathname, search } = window.location
|
const { pathname, search } = window.location
|
||||||
const searchParams = Object.fromEntries(new URLSearchParams(search))
|
const searchParams = Object.fromEntries(new URLSearchParams(search))
|
||||||
initRouter(pathname, searchParams)
|
initRouter(pathname, searchParams)
|
||||||
/*
|
|
||||||
if (SENTRY_DSN) {
|
SentryInit({
|
||||||
Sentry.init({
|
dsn: GLITCHTIP_DSN,
|
||||||
dsn: SENTRY_DSN,
|
tracesSampleRate: 0.01,
|
||||||
|
integrations: [replayIntegration()],
|
||||||
|
// Session Replay
|
||||||
|
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
|
||||||
|
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
|
||||||
})
|
})
|
||||||
}
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line import/no-named-as-default-member
|
// eslint-disable-next-line import/no-named-as-default-member
|
||||||
await i18next
|
await i18next
|
||||||
.use(HttpApi)
|
.use(HttpApi)
|
||||||
|
|
|
@ -5,6 +5,7 @@ export const cdnUrl = 'https://cdn.discours.io'
|
||||||
export const thumborUrl = import.meta.env.PUBLIC_THUMBOR_URL || defaultThumborUrl
|
export const thumborUrl = import.meta.env.PUBLIC_THUMBOR_URL || defaultThumborUrl
|
||||||
|
|
||||||
export const SENTRY_DSN = import.meta.env.PUBLIC_SENTRY_DSN || ''
|
export const SENTRY_DSN = import.meta.env.PUBLIC_SENTRY_DSN || ''
|
||||||
|
export const GLITCHTIP_DSN = import.meta.env.PUBLIC_GLITCHTIP_DSN || ''
|
||||||
|
|
||||||
const defaultSearchUrl = 'https://search.discours.io'
|
const defaultSearchUrl = 'https://search.discours.io'
|
||||||
export const searchUrl = import.meta.env.PUBLIC_SEARCH_URL || defaultSearchUrl
|
export const searchUrl = import.meta.env.PUBLIC_SEARCH_URL || defaultSearchUrl
|
||||||
|
|
Loading…
Reference in New Issue
Block a user