File tree Expand file tree Collapse file tree 4 files changed +22
-5
lines changed
Expand file tree Collapse file tree 4 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
1717 type NormalizationLinkedField ,
1818 Observable ,
1919 type OperationType ,
20+ type PayloadError ,
2021 RecordSource ,
2122 RelayFeatureFlags ,
2223 type RequestParameters ,
@@ -187,10 +188,10 @@ export default class Atmosphere extends Environment {
187188 return Observable . create < GraphQLResponse > ( ( sink ) => {
188189 const _next = sink . next
189190 const _error = sink . error
190- sink . error = ( error : Error | Error [ ] | CloseEvent ) => {
191+ sink . error = ( error : Error | Error [ ] | CloseEvent | PayloadError ) => {
191192 if ( Array . isArray ( error ) ) {
192193 const invalidSessionError = error . find (
193- ( e ) => ( e as any ) . extensions ?. code === 'SESSION_INVALIDATED'
194+ ( e ) => ( e as PayloadError ) . extensions ?. code === 'SESSION_INVALIDATED'
194195 )
195196 if ( invalidSessionError ) {
196197 this . invalidateSession ( invalidSessionError . message )
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ export const PageAccessCombobox = (props: Props) => {
4545 onCompleted ( _res , errors ) {
4646 const firstError = errors ?. [ 0 ]
4747 if ( firstError ) {
48- if ( ( firstError as any ) . extensions ?. code === 'UNAPPROVED_UNLINK' ) {
48+ if ( firstError . extensions ?. code === 'UNAPPROVED_UNLINK' ) {
4949 setAttemptedRole ( role )
5050 return
5151 }
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export const RequestPageAccess = (props: Props) => {
4040 onCompleted : ( _result , errors ) => {
4141 const firstError = errors ?. [ 0 ]
4242 if ( firstError ) {
43- const code = ( firstError as any ) . extensions ?. code
43+ const code = firstError . extensions ?. code
4444 if ( code === 'NOT_FOUND' ) {
4545 atmosphere . eventEmitter . emit ( 'addSnackbar' , {
4646 message : 'Page not found' ,
Original file line number Diff line number Diff line change 1- import type { PayloadError } from 'relay-runtime/lib/network/RelayNetworkTypes'
1+ import type { PayloadError } from 'relay-runtime'
2+
3+ declare module 'relay-runtime' {
4+ interface PayloadError extends Error {
5+ message : string
6+ locations ?:
7+ | Array < {
8+ line : number
9+ column : number
10+ } >
11+ | undefined
12+ path ?: Array < string | number >
13+ extensions ?: {
14+ code ?: string
15+ }
16+ }
17+ }
218
319const getServerError = ( errors : ReadonlyArray < PayloadError > | null | undefined ) =>
420 ( errors && errors [ 0 ] ) || undefined
You can’t perform that action at this time.
0 commit comments