MCPcopy Create free account
hub / github.com/Shopify/function-examples / Auth

Function Auth

sample-apps/discounts/app/routes/auth.login/route.jsx:38–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36}
37
38export default function Auth() {
39 const { polarisTranslations } = useLoaderData();
40 const loaderData = useLoaderData();
41 const actionData = useActionData();
42 const [shop, setShop] = useState("");
43 const { errors } = actionData || loaderData;
44
45 return (
46 <PolarisAppProvider i18n={polarisTranslations}>
47 <Page>
48 <Card>
49 <Form method="post">
50 <FormLayout>
51 <Text variant="headingMd" as="h2">
52 Log in
53 </Text>
54 <TextField
55 type="text"
56 name="shop"
57 label="Shop domain"
58 helpText="example.myshopify.com"
59 value={shop}
60 onChange={setShop}
61 autoComplete="on"
62 error={errors.shop}
63 />
64 <Button submit>Log in</Button>
65 </FormLayout>
66 </Form>
67 </Card>
68 </Page>
69 </PolarisAppProvider>
70 );
71}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected