File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -252,14 +252,15 @@ class AuthenticatedAPI {
252252 ) : Promise < APIResponse > {
253253 const request = await this . #wroomRequest;
254254 const { cookies } = await request . storageState ( ) ;
255- const xsrf = cookies . find ( ( cookie ) => cookie . name === "X_XSRF" ) ?. value ;
256- if ( ! xsrf ) {
255+ const auth = cookies . find ( ( cookie ) => cookie . name === "prismic-auth" ) ;
256+ if ( ! auth ?. value ) {
257257 await this . #logInWroom( ) ;
258258 return await this . postWroom ( ...args ) ;
259259 }
260260
261261 const url = new URL ( args [ 0 ] ) ;
262- url . searchParams . set ( "_" , xsrf ) ;
262+ const xsrf = cookies . find ( ( cookie ) => cookie . name === "X_XSRF" ) ;
263+ if ( xsrf ) url . searchParams . set ( "_" , xsrf . value ) ;
263264 return await request . post ( url . toString ( ) , args [ 1 ] ) ;
264265 }
265266
You can’t perform that action at this time.
0 commit comments