Added /users/me route, and handling auth in frontend
This commit is contained in:
27
frontend/components/layouts/swr-layout.tsx
Normal file
27
frontend/components/layouts/swr-layout.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Hammed Abass. <3 All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
"use client";
|
||||
|
||||
import { SWRConfig } from "swr";
|
||||
|
||||
interface SWRLayoutProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
const SWRLayout: React.FC<SWRLayoutProps> = ({ children }) => (
|
||||
<SWRConfig
|
||||
value={{
|
||||
fetcher: (url: string) =>
|
||||
fetch(url, { credentials: "include" }).then((res) =>
|
||||
res.json(),
|
||||
),
|
||||
revalidateOnFocus: false,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</SWRConfig>
|
||||
);
|
||||
|
||||
export default SWRLayout;
|
||||
Reference in New Issue
Block a user