How to get error status in React with apollo client?

I send by my server back a response: res.status(401).send('Authentication error'); In the browser the error status is ok, so i want to get it in my code to create an action but i can’t get it…

i have this error: networkError TypeError: NetworkError when attempting to fetch resource.
my code:

import { RouterProvider } from 'react-router-dom';
import { ApolloClient, InMemoryCache, ApolloProvider, DefaultOptions } from '@apollo/client';
// @ts-expect-error - no types available
import createUploadLink from 'apollo-upload-client/createUploadLink.mjs';
import { GraphQLWsLink } from '@apollo/client/link/subscriptions';
import { split } from '@apollo/client';
import { getMainDefinition } from '@apollo/client/utilities';
import { createClient } from 'graphql-ws';
import ReactDOM from 'react-dom/client';
import { router } from './routes';
import useHandleLogout from './components/Hook/HandleLogout';
//import { onError } from "apollo-link-error";
import { onError } from "@apollo/client/link/error"; 
import './styles/index.scss';


// Default options for Apollo Client
const defaultOptions: DefaultOptions = {
    watchQuery: {
        fetchPolicy: 'network-only',
        errorPolicy: 'ignore',
    },
    query: {
        fetchPolicy: 'network-only',
        errorPolicy: 'all',
    },
};

const logoutLink = onError(({ networkError }) => {
    
    console.log('networkError', networkError);
    
});

Thank you for your response