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 { appWithTranslation } from "next-i18next"
|
||||||
import { useCookies, CookiesProvider } from 'react-cookie'
|
|
||||||
import { appWithTranslation } from 'next-i18next'
|
|
||||||
|
|
||||||
import type { AppProps } from 'next/app'
|
import type { AppProps } from "next/app"
|
||||||
import Layout from '~components/Layout'
|
import Layout from "~components/Layout"
|
||||||
|
|
||||||
import { accountState } from '~utils/accountState'
|
import "../styles/globals.scss"
|
||||||
|
|
||||||
import '../styles/globals.scss'
|
|
||||||
|
|
||||||
function MyApp({ Component, pageProps }: AppProps) {
|
function MyApp({ Component, pageProps }: AppProps) {
|
||||||
const [cookies] = useCookies(['account'])
|
return (
|
||||||
|
<Layout>
|
||||||
useEffect(() => {
|
<Component {...pageProps} />
|
||||||
if (cookies.account) {
|
</Layout>
|
||||||
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>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default appWithTranslation(MyApp)
|
export default appWithTranslation(MyApp)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue