File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
src/content/pages/problemset Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,15 @@ export function intercept(): void {
1919 password ?: string ,
2020 disbaleIntercept ?: boolean
2121 ) {
22+ let pathname = url
23+ try {
24+ const urlObj = new URL ( url )
25+ pathname = urlObj . pathname
26+ } catch ( error ) { }
2227 if (
2328 ! disbaleIntercept &&
2429 method . toLocaleLowerCase ( ) === 'post' &&
25- url === `/graphql/`
30+ pathname === `/graphql/`
2631 ) {
2732 const originalSend = this . send
2833
@@ -115,6 +120,19 @@ export function intercept(): void {
115120 } catch ( error ) {
116121 //
117122 }
123+ } else if ( typeof str === 'string' ) {
124+ try {
125+ const body = JSON . parse ( str )
126+ const sortOrder = body ?. variables ?. filters ?. sortOrder
127+ if (
128+ sortOrder &&
129+ sortOrder !== 'DESCENDING' &&
130+ sortOrder !== 'ASCENDING'
131+ ) {
132+ body . variables . filters . sortOrder = 'DESCENDING'
133+ str = JSON . stringify ( body )
134+ }
135+ } catch ( error ) { }
118136 }
119137 return originalSend . call ( this , str )
120138 }
You can’t perform that action at this time.
0 commit comments