import Cookies from 'universal-cookie' ; import { Context , Middleware } from '@nuxt/types' ; const authCookieMiddleware = ( { req , store } ) => { if ( process . browser ) { return ; } const cookies = new Cookies ( req . headers . cookie ) ; const accessToken = cookies . get ( 'QIITA_ACCESS_TOKEN' ) ; if ( accessToken ) { store . dispatch ( 'qiita/saveAccessToken' , { accessToken } ) ; } } ; export default authCookieMiddleware ;