From ac05ba8cfd785f3dcf8b83cb114129d5e4386eee Mon Sep 17 00:00:00 2001 From: Alican Erdurmaz Date: Wed, 11 Dec 2024 16:18:26 +0300 Subject: [PATCH] fix(nextjs): auth-provider --- .../plugins/antd-example/src/app/blog-posts/layout.tsx | 2 +- .../plugins/antd-example/src/app/categories/layout.tsx | 2 +- refine-nextjs/plugins/auth-provider-custom/extend.js | 4 ++-- .../auth-provider-custom/src/app/forgot-password/page.tsx | 2 +- .../plugins/auth-provider-custom/src/app/login/page.tsx | 2 +- .../plugins/auth-provider-custom/src/app/register/page.tsx | 2 +- .../{auth-provider.ts => auth-provider.client.ts} | 2 +- .../auth-provider-custom/src/providers/auth-provider/index.ts | 2 -- refine-nextjs/plugins/data-provider-appwrite/extend.js | 2 +- .../data-provider-appwrite/src/app/forgot-password/page.tsx | 2 +- .../plugins/data-provider-appwrite/src/app/login/page.tsx | 2 +- .../plugins/data-provider-appwrite/src/app/register/page.tsx | 2 +- .../src/providers/auth-provider/index.ts | 2 -- refine-nextjs/plugins/data-provider-strapi-v4/extend.js | 4 ++-- .../data-provider-strapi-v4/src/app/forgot-password/page.tsx | 2 +- .../plugins/data-provider-strapi-v4/src/app/login/page.tsx | 2 +- .../plugins/data-provider-strapi-v4/src/app/register/page.tsx | 2 +- .../{auth-provider.ts => auth-provider.client.ts} | 2 +- .../src/providers/auth-provider/index.ts | 2 -- refine-nextjs/plugins/data-provider-supabase/extend.js | 2 +- .../data-provider-supabase/src/app/forgot-password/page.tsx | 2 +- .../plugins/data-provider-supabase/src/app/login/page.tsx | 2 +- .../plugins/data-provider-supabase/src/app/register/page.tsx | 2 +- .../src/providers/auth-provider/index.ts | 2 -- .../plugins/headless-example/src/app/blog-posts/layout.tsx | 2 +- .../plugins/headless-example/src/app/categories/layout.tsx | 2 +- .../plugins/mui-example/src/app/blog-posts/layout.tsx | 2 +- .../plugins/mui-example/src/app/categories/layout.tsx | 2 +- 28 files changed, 26 insertions(+), 34 deletions(-) rename refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/{auth-provider.ts => auth-provider.client.ts} (97%) delete mode 100644 refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/index.ts delete mode 100644 refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/index.ts rename refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/{auth-provider.ts => auth-provider.client.ts} (97%) delete mode 100644 refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/index.ts delete mode 100644 refine-nextjs/plugins/data-provider-supabase/src/providers/auth-provider/index.ts diff --git a/refine-nextjs/plugins/antd-example/src/app/blog-posts/layout.tsx b/refine-nextjs/plugins/antd-example/src/app/blog-posts/layout.tsx index 9cf42336..9d1d35cb 100644 --- a/refine-nextjs/plugins/antd-example/src/app/blog-posts/layout.tsx +++ b/refine-nextjs/plugins/antd-example/src/app/blog-posts/layout.tsx @@ -7,7 +7,7 @@ import { Header } from "@components/header"; import { redirect } from 'next/navigation' <%_ } _%> <%_ if (_app.isAuthProviderCheck) { _%> - import { authProviderServer } from '@providers/auth-provider' + import { authProviderServer } from '@providers/auth-provider/auth-provider.server' import { redirect } from 'next/navigation' <%_ } _%> diff --git a/refine-nextjs/plugins/antd-example/src/app/categories/layout.tsx b/refine-nextjs/plugins/antd-example/src/app/categories/layout.tsx index 9cf42336..9d1d35cb 100644 --- a/refine-nextjs/plugins/antd-example/src/app/categories/layout.tsx +++ b/refine-nextjs/plugins/antd-example/src/app/categories/layout.tsx @@ -7,7 +7,7 @@ import { Header } from "@components/header"; import { redirect } from 'next/navigation' <%_ } _%> <%_ if (_app.isAuthProviderCheck) { _%> - import { authProviderServer } from '@providers/auth-provider' + import { authProviderServer } from '@providers/auth-provider/auth-provider.server' import { redirect } from 'next/navigation' <%_ } _%> diff --git a/refine-nextjs/plugins/auth-provider-custom/extend.js b/refine-nextjs/plugins/auth-provider-custom/extend.js index 89927dc9..1a5bdfa5 100644 --- a/refine-nextjs/plugins/auth-provider-custom/extend.js +++ b/refine-nextjs/plugins/auth-provider-custom/extend.js @@ -1,9 +1,9 @@ const base = { _app: { localImport: [ - 'import { authProvider } from "@providers/auth-provider";', + 'import { authProviderClient } from "@providers/auth-provider/auth-provider.client";', ], - refineProps: ["authProvider={authProvider}"], + refineProps: ["authProvider={authProviderClient}"], refineAntdImports: [], refineMuiImports: [], }, diff --git a/refine-nextjs/plugins/auth-provider-custom/src/app/forgot-password/page.tsx b/refine-nextjs/plugins/auth-provider-custom/src/app/forgot-password/page.tsx index c2b0061f..05159217 100644 --- a/refine-nextjs/plugins/auth-provider-custom/src/app/forgot-password/page.tsx +++ b/refine-nextjs/plugins/auth-provider-custom/src/app/forgot-password/page.tsx @@ -1,5 +1,5 @@ import { AuthPage } from "@components/auth-page"; -import { authProviderServer } from "@providers/auth-provider"; +import { authProviderServer } from "@providers/auth-provider/auth-provider.server"; import { redirect } from "next/navigation"; export default async function ForgotPassword() { diff --git a/refine-nextjs/plugins/auth-provider-custom/src/app/login/page.tsx b/refine-nextjs/plugins/auth-provider-custom/src/app/login/page.tsx index e4e77ff9..daf8875f 100644 --- a/refine-nextjs/plugins/auth-provider-custom/src/app/login/page.tsx +++ b/refine-nextjs/plugins/auth-provider-custom/src/app/login/page.tsx @@ -1,5 +1,5 @@ import { AuthPage } from "@components/auth-page"; -import { authProviderServer } from "@providers/auth-provider"; +import { authProviderServer } from "@providers/auth-provider/auth-provider.server"; import { redirect } from "next/navigation"; export default async function Login() { diff --git a/refine-nextjs/plugins/auth-provider-custom/src/app/register/page.tsx b/refine-nextjs/plugins/auth-provider-custom/src/app/register/page.tsx index b07acae8..5ffce516 100644 --- a/refine-nextjs/plugins/auth-provider-custom/src/app/register/page.tsx +++ b/refine-nextjs/plugins/auth-provider-custom/src/app/register/page.tsx @@ -1,5 +1,5 @@ import { AuthPage } from "@components/auth-page"; -import { authProviderServer } from "@providers/auth-provider"; +import { authProviderServer } from "@providers/auth-provider/auth-provider.server"; import { redirect } from "next/navigation"; export default async function Register() { diff --git a/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.ts b/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.client.ts similarity index 97% rename from refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.ts rename to refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.client.ts index 66a9603c..5c68ec38 100644 --- a/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.ts +++ b/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.client.ts @@ -18,7 +18,7 @@ const mockUsers = [ }, ]; -export const authProvider: AuthProvider = { +export const authProviderClient: AuthProvider = { login: async ({ email, username, password, remember }) => { // Suppose we actually send a request to the back end here. const user = mockUsers[0]; diff --git a/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/index.ts b/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/index.ts deleted file mode 100644 index b7f6d9fe..00000000 --- a/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './auth-provider' -export * from './auth-provider.server' diff --git a/refine-nextjs/plugins/data-provider-appwrite/extend.js b/refine-nextjs/plugins/data-provider-appwrite/extend.js index ec6964d9..b8e8b129 100644 --- a/refine-nextjs/plugins/data-provider-appwrite/extend.js +++ b/refine-nextjs/plugins/data-provider-appwrite/extend.js @@ -2,7 +2,7 @@ const base = { _app: { import: [], localImport: [ - 'import { authProviderClient } from "@providers/auth-provider";', + 'import { authProviderClient } from "@providers/auth-provider/auth-provider.client";', 'import { appwriteDataProvider, appwriteLiveProvider } from "@providers/data-provider";', ], refineProps: [ diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/app/forgot-password/page.tsx b/refine-nextjs/plugins/data-provider-appwrite/src/app/forgot-password/page.tsx index c2b0061f..05159217 100644 --- a/refine-nextjs/plugins/data-provider-appwrite/src/app/forgot-password/page.tsx +++ b/refine-nextjs/plugins/data-provider-appwrite/src/app/forgot-password/page.tsx @@ -1,5 +1,5 @@ import { AuthPage } from "@components/auth-page"; -import { authProviderServer } from "@providers/auth-provider"; +import { authProviderServer } from "@providers/auth-provider/auth-provider.server"; import { redirect } from "next/navigation"; export default async function ForgotPassword() { diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/app/login/page.tsx b/refine-nextjs/plugins/data-provider-appwrite/src/app/login/page.tsx index e4e77ff9..daf8875f 100644 --- a/refine-nextjs/plugins/data-provider-appwrite/src/app/login/page.tsx +++ b/refine-nextjs/plugins/data-provider-appwrite/src/app/login/page.tsx @@ -1,5 +1,5 @@ import { AuthPage } from "@components/auth-page"; -import { authProviderServer } from "@providers/auth-provider"; +import { authProviderServer } from "@providers/auth-provider/auth-provider.server"; import { redirect } from "next/navigation"; export default async function Login() { diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/app/register/page.tsx b/refine-nextjs/plugins/data-provider-appwrite/src/app/register/page.tsx index b07acae8..5ffce516 100644 --- a/refine-nextjs/plugins/data-provider-appwrite/src/app/register/page.tsx +++ b/refine-nextjs/plugins/data-provider-appwrite/src/app/register/page.tsx @@ -1,5 +1,5 @@ import { AuthPage } from "@components/auth-page"; -import { authProviderServer } from "@providers/auth-provider"; +import { authProviderServer } from "@providers/auth-provider/auth-provider.server"; import { redirect } from "next/navigation"; export default async function Register() { diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/index.ts b/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/index.ts deleted file mode 100644 index 36ccb9da..00000000 --- a/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './auth-provider.client' -export * from './auth-provider.server' diff --git a/refine-nextjs/plugins/data-provider-strapi-v4/extend.js b/refine-nextjs/plugins/data-provider-strapi-v4/extend.js index 366f2184..0a271a5c 100644 --- a/refine-nextjs/plugins/data-provider-strapi-v4/extend.js +++ b/refine-nextjs/plugins/data-provider-strapi-v4/extend.js @@ -2,11 +2,11 @@ const base = { _app: { import: [], localImport: [ - 'import { authProvider } from "@providers/auth-provider";', + 'import { authProviderClient } from "@providers/auth-provider/auth-provider.client";', 'import { dataProvider } from "@providers/data-provider";', ], refineProps: [ - "authProvider={authProvider}", + "authProvider={authProviderClient}", "dataProvider={dataProvider}", ], refineAntdImports: [], diff --git a/refine-nextjs/plugins/data-provider-strapi-v4/src/app/forgot-password/page.tsx b/refine-nextjs/plugins/data-provider-strapi-v4/src/app/forgot-password/page.tsx index c2b0061f..05159217 100644 --- a/refine-nextjs/plugins/data-provider-strapi-v4/src/app/forgot-password/page.tsx +++ b/refine-nextjs/plugins/data-provider-strapi-v4/src/app/forgot-password/page.tsx @@ -1,5 +1,5 @@ import { AuthPage } from "@components/auth-page"; -import { authProviderServer } from "@providers/auth-provider"; +import { authProviderServer } from "@providers/auth-provider/auth-provider.server"; import { redirect } from "next/navigation"; export default async function ForgotPassword() { diff --git a/refine-nextjs/plugins/data-provider-strapi-v4/src/app/login/page.tsx b/refine-nextjs/plugins/data-provider-strapi-v4/src/app/login/page.tsx index e4e77ff9..daf8875f 100644 --- a/refine-nextjs/plugins/data-provider-strapi-v4/src/app/login/page.tsx +++ b/refine-nextjs/plugins/data-provider-strapi-v4/src/app/login/page.tsx @@ -1,5 +1,5 @@ import { AuthPage } from "@components/auth-page"; -import { authProviderServer } from "@providers/auth-provider"; +import { authProviderServer } from "@providers/auth-provider/auth-provider.server"; import { redirect } from "next/navigation"; export default async function Login() { diff --git a/refine-nextjs/plugins/data-provider-strapi-v4/src/app/register/page.tsx b/refine-nextjs/plugins/data-provider-strapi-v4/src/app/register/page.tsx index b07acae8..5ffce516 100644 --- a/refine-nextjs/plugins/data-provider-strapi-v4/src/app/register/page.tsx +++ b/refine-nextjs/plugins/data-provider-strapi-v4/src/app/register/page.tsx @@ -1,5 +1,5 @@ import { AuthPage } from "@components/auth-page"; -import { authProviderServer } from "@providers/auth-provider"; +import { authProviderServer } from "@providers/auth-provider/auth-provider.server"; import { redirect } from "next/navigation"; export default async function Register() { diff --git a/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.ts b/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.client.ts similarity index 97% rename from refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.ts rename to refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.client.ts index 3c4115c9..e5f63736 100644 --- a/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.ts +++ b/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.client.ts @@ -8,7 +8,7 @@ import Cookies from "js-cookie"; const strapiAuthHelper = AuthHelper(API_URL + "/api"); -export const authProvider: AuthProvider = { +export const authProviderClient: AuthProvider = { login: async ({ email, password }) => { const { data, status } = await strapiAuthHelper.login(email, password); if (status === 200) { diff --git a/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/index.ts b/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/index.ts deleted file mode 100644 index b7f6d9fe..00000000 --- a/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './auth-provider' -export * from './auth-provider.server' diff --git a/refine-nextjs/plugins/data-provider-supabase/extend.js b/refine-nextjs/plugins/data-provider-supabase/extend.js index e43e3c29..0a271a5c 100644 --- a/refine-nextjs/plugins/data-provider-supabase/extend.js +++ b/refine-nextjs/plugins/data-provider-supabase/extend.js @@ -2,7 +2,7 @@ const base = { _app: { import: [], localImport: [ - 'import { authProviderClient } from "@providers/auth-provider";', + 'import { authProviderClient } from "@providers/auth-provider/auth-provider.client";', 'import { dataProvider } from "@providers/data-provider";', ], refineProps: [ diff --git a/refine-nextjs/plugins/data-provider-supabase/src/app/forgot-password/page.tsx b/refine-nextjs/plugins/data-provider-supabase/src/app/forgot-password/page.tsx index c2b0061f..05159217 100644 --- a/refine-nextjs/plugins/data-provider-supabase/src/app/forgot-password/page.tsx +++ b/refine-nextjs/plugins/data-provider-supabase/src/app/forgot-password/page.tsx @@ -1,5 +1,5 @@ import { AuthPage } from "@components/auth-page"; -import { authProviderServer } from "@providers/auth-provider"; +import { authProviderServer } from "@providers/auth-provider/auth-provider.server"; import { redirect } from "next/navigation"; export default async function ForgotPassword() { diff --git a/refine-nextjs/plugins/data-provider-supabase/src/app/login/page.tsx b/refine-nextjs/plugins/data-provider-supabase/src/app/login/page.tsx index e4e77ff9..daf8875f 100644 --- a/refine-nextjs/plugins/data-provider-supabase/src/app/login/page.tsx +++ b/refine-nextjs/plugins/data-provider-supabase/src/app/login/page.tsx @@ -1,5 +1,5 @@ import { AuthPage } from "@components/auth-page"; -import { authProviderServer } from "@providers/auth-provider"; +import { authProviderServer } from "@providers/auth-provider/auth-provider.server"; import { redirect } from "next/navigation"; export default async function Login() { diff --git a/refine-nextjs/plugins/data-provider-supabase/src/app/register/page.tsx b/refine-nextjs/plugins/data-provider-supabase/src/app/register/page.tsx index b07acae8..5ffce516 100644 --- a/refine-nextjs/plugins/data-provider-supabase/src/app/register/page.tsx +++ b/refine-nextjs/plugins/data-provider-supabase/src/app/register/page.tsx @@ -1,5 +1,5 @@ import { AuthPage } from "@components/auth-page"; -import { authProviderServer } from "@providers/auth-provider"; +import { authProviderServer } from "@providers/auth-provider/auth-provider.server"; import { redirect } from "next/navigation"; export default async function Register() { diff --git a/refine-nextjs/plugins/data-provider-supabase/src/providers/auth-provider/index.ts b/refine-nextjs/plugins/data-provider-supabase/src/providers/auth-provider/index.ts deleted file mode 100644 index eaf5c1c6..00000000 --- a/refine-nextjs/plugins/data-provider-supabase/src/providers/auth-provider/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./auth-provider.client"; -export * from "./auth-provider.server"; diff --git a/refine-nextjs/plugins/headless-example/src/app/blog-posts/layout.tsx b/refine-nextjs/plugins/headless-example/src/app/blog-posts/layout.tsx index 2a7153e8..040dfcf5 100644 --- a/refine-nextjs/plugins/headless-example/src/app/blog-posts/layout.tsx +++ b/refine-nextjs/plugins/headless-example/src/app/blog-posts/layout.tsx @@ -6,7 +6,7 @@ import { Layout as BaseLayout } from "@components/layout"; import { redirect } from 'next/navigation' <%_ } _%> <%_ if (_app.isAuthProviderCheck) { _%> - import { authProviderServer } from '@providers/auth-provider' + import { authProviderServer } from '@providers/auth-provider/auth-provider.server' import { redirect } from 'next/navigation' <%_ } _%> diff --git a/refine-nextjs/plugins/headless-example/src/app/categories/layout.tsx b/refine-nextjs/plugins/headless-example/src/app/categories/layout.tsx index 2a7153e8..040dfcf5 100644 --- a/refine-nextjs/plugins/headless-example/src/app/categories/layout.tsx +++ b/refine-nextjs/plugins/headless-example/src/app/categories/layout.tsx @@ -6,7 +6,7 @@ import { Layout as BaseLayout } from "@components/layout"; import { redirect } from 'next/navigation' <%_ } _%> <%_ if (_app.isAuthProviderCheck) { _%> - import { authProviderServer } from '@providers/auth-provider' + import { authProviderServer } from '@providers/auth-provider/auth-provider.server' import { redirect } from 'next/navigation' <%_ } _%> diff --git a/refine-nextjs/plugins/mui-example/src/app/blog-posts/layout.tsx b/refine-nextjs/plugins/mui-example/src/app/blog-posts/layout.tsx index 3c6c010d..ed396aff 100644 --- a/refine-nextjs/plugins/mui-example/src/app/blog-posts/layout.tsx +++ b/refine-nextjs/plugins/mui-example/src/app/blog-posts/layout.tsx @@ -7,7 +7,7 @@ import { Header } from "@components/header"; import { redirect } from 'next/navigation' <%_ } _%> <%_ if (_app.isAuthProviderCheck) { _%> - import { authProviderServer } from '@providers/auth-provider' + import { authProviderServer } from '@providers/auth-provider/auth-provider.server' import { redirect } from 'next/navigation' <%_ } _%> diff --git a/refine-nextjs/plugins/mui-example/src/app/categories/layout.tsx b/refine-nextjs/plugins/mui-example/src/app/categories/layout.tsx index 3c6c010d..ed396aff 100644 --- a/refine-nextjs/plugins/mui-example/src/app/categories/layout.tsx +++ b/refine-nextjs/plugins/mui-example/src/app/categories/layout.tsx @@ -7,7 +7,7 @@ import { Header } from "@components/header"; import { redirect } from 'next/navigation' <%_ } _%> <%_ if (_app.isAuthProviderCheck) { _%> - import { authProviderServer } from '@providers/auth-provider' + import { authProviderServer } from '@providers/auth-provider/auth-provider.server' import { redirect } from 'next/navigation' <%_ } _%>