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;
|
||||
height: $diameter;
|
||||
width: $diameter;
|
||||
transition: transform 100ms;
|
||||
transform: translateX(-2px);
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 3px;
|
||||
z-index: 3;
|
||||
|
||||
&:hover {
|
||||
|
|
@ -98,7 +99,7 @@
|
|||
|
||||
&[data-state='checked'] {
|
||||
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 {
|
||||
account: AccountCookie
|
||||
user: UserCookie
|
||||
account?: AccountCookie
|
||||
user?: UserCookie
|
||||
locale: string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,18 +6,20 @@ export default function retrieveCookies(
|
|||
res?: NextApiResponse
|
||||
): GranblueCookie | undefined {
|
||||
const cookies = getCookies({ req, res })
|
||||
if (!cookies) return undefined
|
||||
|
||||
const {
|
||||
account: accountData,
|
||||
user: userData,
|
||||
NEXT_LOCALE: localeData,
|
||||
} = cookies
|
||||
if (!accountData || !userData) return undefined
|
||||
|
||||
if ((!accountData || !userData) && localeData)
|
||||
return { account: undefined, user: undefined, locale: localeData }
|
||||
|
||||
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