Remove unused cookie code from _app
This commit is contained in:
parent
9d769f5aa8
commit
752e468c4b
1 changed files with 9 additions and 34 deletions
|
|
@ -1,41 +1,16 @@
|
|||
import { useEffect } from 'react'
|
||||
import { useCookies, CookiesProvider } from 'react-cookie'
|
||||
import { appWithTranslation } from 'next-i18next'
|
||||
import { appWithTranslation } from "next-i18next"
|
||||
|
||||
import type { AppProps } from 'next/app'
|
||||
import Layout from '~components/Layout'
|
||||
import type { AppProps } from "next/app"
|
||||
import Layout from "~components/Layout"
|
||||
|
||||
import { accountState } from '~utils/accountState'
|
||||
|
||||
import '../styles/globals.scss'
|
||||
import "../styles/globals.scss"
|
||||
|
||||
function MyApp({ Component, pageProps }: AppProps) {
|
||||
const [cookies] = useCookies(['account'])
|
||||
|
||||
useEffect(() => {
|
||||
if (cookies.account) {
|
||||
console.log(`Logged in as user "${cookies.account.username}"`)
|
||||
|
||||
accountState.account.authorized = true
|
||||
accountState.account.user = {
|
||||
id: cookies.account.user_id,
|
||||
username: cookies.account.username,
|
||||
picture: '',
|
||||
element: '',
|
||||
gender: 0
|
||||
}
|
||||
} else {
|
||||
console.log(`You are not currently logged in.`)
|
||||
}
|
||||
}, [cookies.account])
|
||||
|
||||
return (
|
||||
<CookiesProvider>
|
||||
<Layout>
|
||||
<Component {...pageProps} />
|
||||
</Layout>
|
||||
</CookiesProvider>
|
||||
)
|
||||
return (
|
||||
<Layout>
|
||||
<Component {...pageProps} />
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
|
||||
export default appWithTranslation(MyApp)
|
||||
|
|
|
|||
Loading…
Reference in a new issue