Skip to content

Commit

Permalink
fix(refine-remix): replace LoaderArgs with LoaderFunctionArgs type (
Browse files Browse the repository at this point in the history
  • Loading branch information
aliemir authored May 29, 2024
1 parent e5d45e2 commit ecb6a7d
Show file tree
Hide file tree
Showing 29 changed files with 64 additions and 64 deletions.
8 changes: 4 additions & 4 deletions refine-remix/plugins/antd-example/app/routes/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { ThemedLayoutV2, ThemedSiderV2, ThemedTitleV2 } from "@refinedev/antd";
import { Outlet } from "@remix-run/react";
import { Header } from "~/components/header";
<%_ if (_app.isAuthProviderCheck) { _%>
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";
import { redirect } from "@remix-run/node";
import { authProvider } from "~/authProvider";
<%_ } _%>

<%_ if (_app.isNextAuthCheck) { _%>
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";
import { redirect } from "@remix-run/node";
import { authenticator } from "~/utils/auth.server";
<%_ } _%>
Expand Down Expand Up @@ -44,7 +44,7 @@ export default function BaseLayout() {
* If not, we're redirecting the user to the login page.
* This is applied for all routes that are nested under this layout (_protected).
*/
export async function loader({ request }: LoaderArgs) {
export async function loader({ request }: LoaderFunctionArgs) {
const { authenticated, redirectTo } = await authProvider.check(request);

if (!authenticated) {
Expand All @@ -61,7 +61,7 @@ export default function BaseLayout() {
* If not, we're redirecting the user to the login page.
* This is applied for all routes that are nested under this layout (_protected).
*/
export const loader = async ({ request }: LoaderArgs) => {
export const loader = async ({ request }: LoaderFunctionArgs) => {
const session = await authenticator.isAuthenticated(request);
const pathname = new URL(request.url).pathname;

Expand Down
4 changes: 2 additions & 2 deletions refine-remix/plugins/auth-provider-auth0/app/routes/_auth.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Outlet } from "@remix-run/react";
import { LoaderArgs, redirect } from "@remix-run/node";
import { LoaderFunctionArgs, redirect } from "@remix-run/node";
import { authenticator } from "~/utils/auth.server";

export default function AuthLayout() {
// no layout is applied for the auth routes
return <Outlet />;
}

export const loader = async ({ request }: LoaderArgs) => {
export const loader = async ({ request }: LoaderFunctionArgs) => {
const session = await authenticator.isAuthenticated(request);

if (session) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Outlet } from "@remix-run/react";
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";
import { redirect } from "@remix-run/node";
<%_ if (answers["ui-framework"] === 'antd') { _%>
import {
Expand Down Expand Up @@ -68,7 +68,7 @@ export default function BaseLayout() {
* If not, we're redirecting the user to the login page.
* This is applied for all routes that are nested under this layout (_protected).
*/
export const loader = async ({ request }: LoaderArgs) => {
export const loader = async ({ request }: LoaderFunctionArgs) => {
const session = await authenticator.isAuthenticated(request);
const pathname = new URL(request.url).pathname;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LoaderArgs, ActionArgs } from "@remix-run/node";
import type { LoaderFunctionArgs, ActionArgs } from "@remix-run/node";
import { authenticator } from "~/utils/auth.server";

export const action = async ({ request }: ActionArgs) => {
Expand All @@ -7,7 +7,7 @@ export const action = async ({ request }: ActionArgs) => {
});
};

export const loader = async ({ request }: LoaderArgs) => {
export const loader = async ({ request }: LoaderFunctionArgs) => {
await authenticator.authenticate("auth0", request, {
failureRedirect: "/login",
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";

import { authenticator } from "~/utils/auth.server";

export const loader = ({ request }: LoaderArgs) => {
export const loader = ({ request }: LoaderFunctionArgs) => {
return authenticator.authenticate("auth0", request, {
failureRedirect: "/login",
successRedirect: "http://localhost:3000/",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";

import { redirect } from "@remix-run/node";

import { destroySession, getSession } from "~/services/session.server";

export const loader = async ({ request }: LoaderArgs) => {
export const loader = async ({ request }: LoaderFunctionArgs) => {
const session = await getSession(request.headers.get("Cookie"));
return redirect(`/`, {
headers: {
Expand Down
4 changes: 2 additions & 2 deletions refine-remix/plugins/auth-provider-auth0/extend.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const base = {
_app: {
localImport: [
`import type { LoaderArgs } from "@remix-run/node";`,
`import type { LoaderFunctionArgs } from "@remix-run/node";`,
`import { json } from "@remix-run/node";`,
`import { authenticator } from "~/utils/auth.server";`,
],
Expand All @@ -10,7 +10,7 @@ const base = {
refineAntdImports: [],
refineMuiImports: [],
loader: [
`export const loader = async ({ request }: LoaderArgs) => {
`export const loader = async ({ request }: LoaderFunctionArgs) => {
const profile = await authenticator.isAuthenticated(request);
const to = new URL(request.url).searchParams.get("to");
return json({ profile, to });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Outlet } from "@remix-run/react";
import { redirect } from "@remix-run/node";
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";

import { authProvider } from "~/authProvider";

Expand All @@ -14,7 +14,7 @@ export default function AuthLayout() {
* Alternatively, we could also use the `Authenticated` component inside the `AuthLayout` to handle the redirect.
* But, server-side redirects are more performant.
*/
export async function loader({ request }: LoaderArgs) {
export async function loader({ request }: LoaderFunctionArgs) {
const { authenticated, redirectTo } = await authProvider.check(request);

if (authenticated) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Outlet } from "@remix-run/react";
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";
import { redirect } from "@remix-run/node";
<%_ if (answers["ui-framework"] === 'antd') { _%>
import {
Expand Down Expand Up @@ -67,7 +67,7 @@ export default function BaseLayout() {
* If not, we're redirecting the user to the login page.
* This is applied for all routes that are nested under this layout (_protected).
*/
export async function loader({ request }: LoaderArgs) {
export async function loader({ request }: LoaderFunctionArgs) {
const { authenticated, redirectTo } = await authProvider.check(request);
if (!authenticated) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Outlet } from "@remix-run/react";
import { LoaderArgs, redirect } from "@remix-run/node";
import { LoaderFunctionArgs, redirect } from "@remix-run/node";
import { authenticator } from "~/utils/auth.server";

export default function AuthLayout() {
// no layout is applied for the auth routes
return <Outlet />;
}

export const loader = async ({ request }: LoaderArgs) => {
export const loader = async ({ request }: LoaderFunctionArgs) => {
const session = await authenticator.isAuthenticated(request);

if (session) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Outlet } from "@remix-run/react";
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";
import { redirect } from "@remix-run/node";
<%_ if (answers["ui-framework"] === 'antd') { _%>
import {
Expand Down Expand Up @@ -67,7 +67,7 @@ export default function BaseLayout() {
* If not, we're redirecting the user to the login page.
* This is applied for all routes that are nested under this layout (_protected).
*/
export const loader = async ({ request }: LoaderArgs) => {
export const loader = async ({ request }: LoaderFunctionArgs) => {
const session = await authenticator.isAuthenticated(request);
const pathname = new URL(request.url).pathname;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LoaderArgs, ActionArgs } from "@remix-run/node";
import type { LoaderFunctionArgs, ActionArgs } from "@remix-run/node";
import { authenticator } from "~/utils/auth.server";

export const action = async ({ request }: ActionArgs) => {
Expand All @@ -7,7 +7,7 @@ export const action = async ({ request }: ActionArgs) => {
});
};

export const loader = async ({ request }: LoaderArgs) => {
export const loader = async ({ request }: LoaderFunctionArgs) => {
await authenticator.authenticate("google", request, {
failureRedirect: "/login",
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";

import { authenticator } from "~/utils/auth.server";

export const loader = ({ request }: LoaderArgs) => {
export const loader = ({ request }: LoaderFunctionArgs) => {
return authenticator.authenticate("google", request, {
failureRedirect: "/login",
successRedirect: "http://localhost:3000/",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";

import { redirect } from "@remix-run/node";

import { destroySession, getSession } from "~/services/session.server";

export const loader = async ({ request }: LoaderArgs) => {
export const loader = async ({ request }: LoaderFunctionArgs) => {
const session = await getSession(request.headers.get("Cookie"));
return redirect(`/`, {
headers: {
Expand Down
4 changes: 2 additions & 2 deletions refine-remix/plugins/auth-provider-google/extend.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const base = {
_app: {
localImport: [
`import type { LoaderArgs } from "@remix-run/node";`,
`import type { LoaderFunctionArgs } from "@remix-run/node";`,
`import { json } from "@remix-run/node";`,
`import { authenticator } from "~/utils/auth.server";`,
],
Expand All @@ -10,7 +10,7 @@ const base = {
refineAntdImports: [],
refineMuiImports: [],
loader: [
`export const loader = async ({ request }: LoaderArgs) => {
`export const loader = async ({ request }: LoaderFunctionArgs) => {
const profile = await authenticator.isAuthenticated(request);
const to = new URL(request.url).searchParams.get("to");
return json({ profile, to });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Outlet } from "@remix-run/react";
import { LoaderArgs, redirect } from "@remix-run/node";
import { LoaderFunctionArgs, redirect } from "@remix-run/node";
import { authenticator } from "~/utils/auth.server";

export default function AuthLayout() {
// no layout is applied for the auth routes
return <Outlet />;
}

export const loader = async ({ request }: LoaderArgs) => {
export const loader = async ({ request }: LoaderFunctionArgs) => {
const session = await authenticator.isAuthenticated(request);

if (session) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Outlet } from "@remix-run/react";
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";
import { redirect } from "@remix-run/node";
<%_ if (answers["ui-framework"] === 'antd') { _%>
import {
Expand Down Expand Up @@ -67,7 +67,7 @@ export default function BaseLayout() {
* If not, we're redirecting the user to the login page.
* This is applied for all routes that are nested under this layout (_protected).
*/
export const loader = async ({ request }: LoaderArgs) => {
export const loader = async ({ request }: LoaderFunctionArgs) => {
const session = await authenticator.isAuthenticated(request);
const pathname = new URL(request.url).pathname;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LoaderArgs, ActionArgs } from "@remix-run/node";
import type { LoaderFunctionArgs, ActionArgs } from "@remix-run/node";
import { authenticator } from "~/utils/auth.server";

export const action = async ({ request }: ActionArgs) => {
Expand All @@ -7,7 +7,7 @@ export const action = async ({ request }: ActionArgs) => {
});
};

export const loader = async ({ request }: LoaderArgs) => {
export const loader = async ({ request }: LoaderFunctionArgs) => {
await authenticator.authenticate("keycloak", request, {
failureRedirect: "/login",
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";

import { authenticator } from "~/utils/auth.server";

export const loader = ({ request }: LoaderArgs) => {
export const loader = ({ request }: LoaderFunctionArgs) => {
return authenticator.authenticate("keycloak", request, {
failureRedirect: "/login",
successRedirect: "http://localhost:3000/",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";

import { redirect } from "@remix-run/node";

import { destroySession, getSession } from "~/services/session.server";

export const loader = async ({ request }: LoaderArgs) => {
export const loader = async ({ request }: LoaderFunctionArgs) => {
const session = await getSession(request.headers.get("Cookie"));
return redirect(`/`, {
headers: {
Expand Down
4 changes: 2 additions & 2 deletions refine-remix/plugins/auth-provider-keycloak/extend.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const base = {
_app: {
localImport: [
`import type { LoaderArgs } from "@remix-run/node";`,
`import type { LoaderFunctionArgs } from "@remix-run/node";`,
`import { json } from "@remix-run/node";`,
`import { authenticator } from "~/utils/auth.server";`,
],
Expand All @@ -10,7 +10,7 @@ const base = {
refineAntdImports: [],
refineMuiImports: [],
loader: [
`export const loader = async ({ request }: LoaderArgs) => {
`export const loader = async ({ request }: LoaderFunctionArgs) => {
const profile = await authenticator.isAuthenticated(request);
const to = new URL(request.url).searchParams.get("to");
return json({ profile, to });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Outlet } from "@remix-run/react";
import { redirect } from "@remix-run/node";
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";

import { authProvider } from "~/authProvider";

Expand All @@ -14,7 +14,7 @@ export default function AuthLayout() {
* Alternatively, we could also use the `Authenticated` component inside the `AuthLayout` to handle the redirect.
* But, server-side redirects are more performant.
*/
export async function loader({ request }: LoaderArgs) {
export async function loader({ request }: LoaderFunctionArgs) {
const { authenticated, redirectTo } = await authProvider.check(request);

if (authenticated) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Outlet } from "@remix-run/react";
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";
import { redirect } from "@remix-run/node";
<%_ if (answers["ui-framework"] === 'antd') { _%>
import {
Expand Down Expand Up @@ -67,7 +67,7 @@ export default function BaseLayout() {
* If not, we're redirecting the user to the login page.
* This is applied for all routes that are nested under this layout (_protected).
*/
export async function loader({ request }: LoaderArgs) {
export async function loader({ request }: LoaderFunctionArgs) {
const { authenticated, redirectTo } = await authProvider.check(request);
if (!authenticated) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Outlet } from "@remix-run/react";
import { redirect } from "@remix-run/node";
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";

import { authProvider } from "~/authProvider";

Expand All @@ -14,7 +14,7 @@ export default function AuthLayout() {
* Alternatively, we could also use the `Authenticated` component inside the `AuthLayout` to handle the redirect.
* But, server-side redirects are more performant.
*/
export async function loader({ request }: LoaderArgs) {
export async function loader({ request }: LoaderFunctionArgs) {
const { authenticated, redirectTo } = await authProvider.check(request);

if (authenticated) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Outlet } from "@remix-run/react";
import type { LoaderArgs } from "@remix-run/node";
import type { LoaderFunctionArgs } from "@remix-run/node";
import { redirect } from "@remix-run/node";
<%_ if (answers["ui-framework"] === 'antd') { _%>
import {
Expand Down Expand Up @@ -67,7 +67,7 @@ export default function BaseLayout() {
* If not, we're redirecting the user to the login page.
* This is applied for all routes that are nested under this layout (_protected).
*/
export async function loader({ request }: LoaderArgs) {
export async function loader({ request }: LoaderFunctionArgs) {
const { authenticated, redirectTo } = await authProvider.check(request);
if (!authenticated) {
Expand Down
Loading

0 comments on commit ecb6a7d

Please sign in to comment.