1+ import { Route } from "./+types/route" ;
12import { AppProvider } from "@shopify/shopify-app-react-router/react" ;
23import { useState } from "react" ;
3- import type { ActionFunctionArgs , LoaderFunctionArgs } from "react-router" ;
44import { Form , useActionData , useLoaderData } from "react-router" ;
5-
65import { login } from "../../shopify.server" ;
76import { loginErrorMessage } from "./error.server" ;
87
9- export const loader = async ( { request } : LoaderFunctionArgs ) => {
8+ export const loader = async ( { request } : Route . LoaderArgs ) => {
109 const errors = loginErrorMessage ( await login ( request ) ) ;
1110
1211 return { errors } ;
1312} ;
1413
15- export const action = async ( { request } : ActionFunctionArgs ) => {
14+ export const action = async ( { request } : Route . ActionArgs ) => {
1615 const errors = loginErrorMessage ( await login ( request ) ) ;
1716
1817 return {
@@ -30,18 +29,18 @@ export default function Auth() {
3029 < AppProvider embedded = { false } >
3130 < s-page >
3231 < Form method = "post" >
33- < s-section heading = "Log in" >
34- < s-text-field
35- name = "shop"
36- label = "Shop domain"
37- details = "example.myshopify.com"
38- value = { shop }
39- onChange = { ( e ) => setShop ( e . currentTarget . value ) }
40- autocomplete = "on"
41- error = { errors . shop }
42- > </ s-text-field >
43- < s-button type = "submit" > Log in</ s-button >
44- </ s-section >
32+ < s-section heading = "Log in" >
33+ < s-text-field
34+ name = "shop"
35+ label = "Shop domain"
36+ details = "example.myshopify.com"
37+ value = { shop }
38+ onChange = { ( e ) => setShop ( e . currentTarget . value ) }
39+ autocomplete = "on"
40+ error = { errors . shop }
41+ > </ s-text-field >
42+ < s-button type = "submit" > Log in</ s-button >
43+ </ s-section >
4544 </ Form >
4645 </ s-page >
4746 </ AppProvider >
0 commit comments