Merge pull request #127 from jedmund/fix-language-switch
Fix language switch in logged-out menu
This commit is contained in:
commit
81c6c22337
3 changed files with 15 additions and 12 deletions
|
|
@ -88,8 +88,9 @@
|
||||||
display: block;
|
display: block;
|
||||||
height: $diameter;
|
height: $diameter;
|
||||||
width: $diameter;
|
width: $diameter;
|
||||||
transition: transform 100ms;
|
position: absolute;
|
||||||
transform: translateX(-2px);
|
top: 3px;
|
||||||
|
left: 3px;
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|
@ -98,7 +99,7 @@
|
||||||
|
|
||||||
&[data-state='checked'] {
|
&[data-state='checked'] {
|
||||||
background: $grey-100;
|
background: $grey-100;
|
||||||
transform: translateX(17px);
|
left: 23px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
4
types/GranblueCookie.d.ts
vendored
4
types/GranblueCookie.d.ts
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
interface GranblueCookie {
|
interface GranblueCookie {
|
||||||
account: AccountCookie
|
account?: AccountCookie
|
||||||
user: UserCookie
|
user?: UserCookie
|
||||||
locale: string
|
locale: string
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,20 @@ export default function retrieveCookies(
|
||||||
res?: NextApiResponse
|
res?: NextApiResponse
|
||||||
): GranblueCookie | undefined {
|
): GranblueCookie | undefined {
|
||||||
const cookies = getCookies({ req, res })
|
const cookies = getCookies({ req, res })
|
||||||
if (!cookies) return undefined
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
account: accountData,
|
account: accountData,
|
||||||
user: userData,
|
user: userData,
|
||||||
NEXT_LOCALE: localeData,
|
NEXT_LOCALE: localeData,
|
||||||
} = cookies
|
} = cookies
|
||||||
if (!accountData || !userData) return undefined
|
|
||||||
|
|
||||||
const account = JSON.parse(decodeURIComponent(accountData)) ?? undefined
|
if ((!accountData || !userData) && localeData)
|
||||||
const user = JSON.parse(decodeURIComponent(userData)) ?? undefined
|
return { account: undefined, user: undefined, locale: localeData }
|
||||||
const locale = localeData as string
|
|
||||||
|
|
||||||
return { account, user, locale }
|
if (accountData && userData) {
|
||||||
|
const account = JSON.parse(decodeURIComponent(accountData)) ?? undefined
|
||||||
|
const user = JSON.parse(decodeURIComponent(userData)) ?? undefined
|
||||||
|
const locale = localeData as string
|
||||||
|
|
||||||
|
return { account, user, locale }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue