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
|
||||
|
||||
- name: Check types
|
||||
run: npm run typecheck
|
||||
run: npm run check:types
|
||||
|
||||
- name: Lint with Biome
|
||||
run: npm run check:code
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
"lint:styles:fix": "stylelint **/*.{scss,css} --fix",
|
||||
"preview": "vite preview",
|
||||
"start": "vite",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck:watch": "tsc --noEmit --watch"
|
||||
"check:types": "tsc --noEmit",
|
||||
"check:types:watch": "tsc --noEmit --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"form-data": "4.0.0",
|
||||
|
|
|
@ -97,7 +97,12 @@ export const LoginForm = () => {
|
|||
const { errors } = await signIn({ email: email(), password: password() })
|
||||
console.error('[signIn errors]', errors)
|
||||
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) => ({
|
||||
...prev,
|
||||
password: t('Something went wrong, check email and password'),
|
||||
|
|
|
@ -61,7 +61,12 @@ export const SendResetLinkForm = () => {
|
|||
redirect_uri: window.location.origin,
|
||||
})
|
||||
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)
|
||||
}
|
||||
if (data.message) setMessage(data.message)
|
||||
|
|
|
@ -57,6 +57,7 @@ export const HeaderAuth = (props: Props) => {
|
|||
toggleEditorPanel()
|
||||
}
|
||||
|
||||
// FIXME: use or remove
|
||||
const handleSaveClick = () => {
|
||||
const hasTopics = form.selectedTopics?.length > 0
|
||||
if (hasTopics) {
|
||||
|
@ -110,7 +111,13 @@ export const HeaderAuth = (props: Props) => {
|
|||
<div class={clsx('col-auto col-lg-7', styles.usernav)}>
|
||||
<div class={styles.userControl}>
|
||||
<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')}>
|
||||
<span class={styles.textLabel}>{t('Create post')}</span>
|
||||
<Icon name="pencil-outline" class={styles.icon} />
|
||||
|
@ -217,8 +224,14 @@ export const HeaderAuth = (props: Props) => {
|
|||
</div>
|
||||
</Show>
|
||||
|
||||
<Show when={isCreatePostButtonVisible() && !author()?.id}>
|
||||
<div class={clsx(styles.userControlItem, styles.userControlItemVerbose)}>
|
||||
<Show when={isCreatePostButtonVisible() && !!author()?.id}>
|
||||
<div
|
||||
class={clsx(
|
||||
styles.userControlItem,
|
||||
styles.userControlItemVerbose,
|
||||
// styles.userControlItemCreate,
|
||||
)}
|
||||
>
|
||||
<a href={getPagePath(router, 'create')}>
|
||||
<span class={styles.textLabel}>{t('Create post')}</span>
|
||||
<Icon name="pencil-outline" class={styles.icon} />
|
||||
|
@ -241,25 +254,19 @@ export const HeaderAuth = (props: Props) => {
|
|||
</Show>
|
||||
}
|
||||
>
|
||||
<Show
|
||||
when={isSaveButtonVisible()}
|
||||
fallback={
|
||||
<div class={clsx(styles.userControlItem)}>
|
||||
<a href={getPagePath(router, 'inbox')}>
|
||||
<div classList={{ entered: page().path === '/inbox' }}>
|
||||
<Icon name="inbox-white" class={styles.icon} />
|
||||
<Icon name="inbox-white-hover" class={clsx(styles.icon, styles.iconHover)} />
|
||||
</div>
|
||||
</a>
|
||||
</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>
|
||||
<Show when={!isSaveButtonVisible()}>
|
||||
<div
|
||||
class={clsx(
|
||||
styles.userControlItem,
|
||||
// styles.userControlItemInbox
|
||||
)}
|
||||
>
|
||||
<a href={getPagePath(router, 'inbox')}>
|
||||
<div classList={{ entered: page().path === '/inbox' }}>
|
||||
<Icon name="inbox-white" class={styles.icon} />
|
||||
<Icon name="inbox-white-hover" class={clsx(styles.icon, styles.iconHover)} />
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</Show>
|
||||
</Show>
|
||||
|
|
|
@ -48,7 +48,7 @@ export const TopicBadge = (props: Props) => {
|
|||
lang() === 'en' ? capitalize(props.topic.slug.replaceAll('-', ' ')) : props.topic.title
|
||||
|
||||
return (
|
||||
<div class={clsx(styles.TopicBadge, { [styles.TopicBadgeSubscriptionsMode]: props.subscriptionsMode })}>
|
||||
<div class={clsx(styles.TopicBadge, props.subscriptionsMode)}>
|
||||
<div class={styles.content}>
|
||||
<div class={styles.basicInfo}>
|
||||
<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 { PageContext } from './types'
|
||||
|
||||
// import * as Sentry from '@sentry/browser'
|
||||
import { init as SentryInit, replayIntegration } from '@sentry/browser'
|
||||
import i18next from 'i18next'
|
||||
import HttpApi from 'i18next-http-backend'
|
||||
import ICU from 'i18next-icu'
|
||||
|
@ -9,7 +9,7 @@ import { hydrate } from 'solid-js/web'
|
|||
|
||||
import { App } from '../components/App'
|
||||
import { initRouter } from '../stores/router'
|
||||
// import { SENTRY_DSN } from '../utils/config'
|
||||
import { GLITCHTIP_DSN } from '../utils/config'
|
||||
import { resolveHydrationPromise } from '../utils/hydrationPromise'
|
||||
|
||||
let layoutReady = false
|
||||
|
@ -20,13 +20,16 @@ export const render = async (pageContext: PageContextBuiltInClientWithClientRout
|
|||
const { pathname, search } = window.location
|
||||
const searchParams = Object.fromEntries(new URLSearchParams(search))
|
||||
initRouter(pathname, searchParams)
|
||||
/*
|
||||
if (SENTRY_DSN) {
|
||||
Sentry.init({
|
||||
dsn: SENTRY_DSN,
|
||||
})
|
||||
}
|
||||
*/
|
||||
|
||||
SentryInit({
|
||||
dsn: GLITCHTIP_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
|
||||
await i18next
|
||||
.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 SENTRY_DSN = import.meta.env.PUBLIC_SENTRY_DSN || ''
|
||||
export const GLITCHTIP_DSN = import.meta.env.PUBLIC_GLITCHTIP_DSN || ''
|
||||
|
||||
const defaultSearchUrl = 'https://search.discours.io'
|
||||
export const searchUrl = import.meta.env.PUBLIC_SEARCH_URL || defaultSearchUrl
|
||||
|
|
Loading…
Reference in New Issue
Block a user