mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 15:35:55 +01:00
🚚 Change setCookies to setCookie
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Center, Loader, Select, Tooltip } from '@mantine/core';
|
||||
import { setCookies } from 'cookies-next';
|
||||
import { setCookie } from 'cookies-next';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useConfig } from '../../tools/state';
|
||||
|
||||
@@ -26,7 +26,7 @@ export default function ConfigChanger() {
|
||||
label="Config loader"
|
||||
onChange={(e) => {
|
||||
loadConfig(e ?? 'default');
|
||||
setCookies('config-name', e ?? 'default', {
|
||||
setCookie('config-name', e ?? 'default', {
|
||||
maxAge: 60 * 60 * 24 * 30,
|
||||
sameSite: 'strict',
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import { DropzoneStatus, FullScreenDropzone } from '@mantine/dropzone';
|
||||
import { showNotification } from '@mantine/notifications';
|
||||
import { useRef } from 'react';
|
||||
import { useRouter } from 'next/router';
|
||||
import { setCookies } from 'cookies-next';
|
||||
import { setCookie } from 'cookies-next';
|
||||
import { useConfig } from '../../tools/state';
|
||||
import { Config } from '../../tools/types';
|
||||
import { migrateToIdConfig } from '../../tools/migrate';
|
||||
@@ -90,7 +90,7 @@ export default function LoadConfigComponent(props: any) {
|
||||
icon: <Check />,
|
||||
message: undefined,
|
||||
});
|
||||
setCookies('config-name', newConfig.name, {
|
||||
setCookie('config-name', newConfig.name, {
|
||||
maxAge: 60 * 60 * 24 * 30,
|
||||
sameSite: 'strict',
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GetServerSidePropsContext } from 'next';
|
||||
import { useState } from 'react';
|
||||
import { AppProps } from 'next/app';
|
||||
import { getCookie, setCookies } from 'cookies-next';
|
||||
import { getCookie, setCookie } from 'cookies-next';
|
||||
import Head from 'next/head';
|
||||
import { MantineProvider, ColorScheme, ColorSchemeProvider, MantineTheme } from '@mantine/core';
|
||||
import { NotificationsProvider } from '@mantine/notifications';
|
||||
@@ -30,7 +30,7 @@ export default function App(this: any, props: AppProps & { colorScheme: ColorSch
|
||||
const toggleColorScheme = (value?: ColorScheme) => {
|
||||
const nextColorScheme = value || (colorScheme === 'dark' ? 'light' : 'dark');
|
||||
setColorScheme(nextColorScheme);
|
||||
setCookies('color-scheme', nextColorScheme, { maxAge: 60 * 60 * 24 * 30 });
|
||||
setCookie('color-scheme', nextColorScheme, { maxAge: 60 * 60 * 24 * 30 });
|
||||
};
|
||||
useHotkeys([['mod+J', () => toggleColorScheme()]]);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getCookie, setCookies } from 'cookies-next';
|
||||
import { getCookie, setCookie } from 'cookies-next';
|
||||
import { GetServerSidePropsContext } from 'next';
|
||||
import { useEffect } from 'react';
|
||||
import AppShelf from '../components/AppShelf/AppShelf';
|
||||
@@ -16,7 +16,7 @@ export async function getServerSideProps({
|
||||
}: GetServerSidePropsContext): Promise<{ props: { config: Config } }> {
|
||||
let cookie = getCookie('config-name', { req, res });
|
||||
if (!cookie) {
|
||||
setCookies('config-name', 'default', {
|
||||
setCookie('config-name', 'default', {
|
||||
req,
|
||||
res,
|
||||
maxAge: 60 * 60 * 24 * 30,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { PasswordInput, Anchor, Paper, Title, Text, Container, Group, Button } from '@mantine/core';
|
||||
import { setCookies } from 'cookies-next';
|
||||
import { setCookie } from 'cookies-next';
|
||||
import { useForm } from '@mantine/hooks';
|
||||
import { showNotification, updateNotification } from '@mantine/notifications';
|
||||
import axios from 'axios';
|
||||
@@ -53,7 +53,7 @@ export default function AuthenticationTitle() {
|
||||
>
|
||||
<form
|
||||
onSubmit={form.onSubmit((values) => {
|
||||
setCookies('password', values.password, {
|
||||
setCookie('password', values.password, {
|
||||
maxAge: 60 * 60 * 24 * 30,
|
||||
sameSite: 'lax',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user