on master help sign in
index: add shore
ff332a2pkova
pages/index.js+38
@@ -21,6 +21,27 @@ import fs from "fs";
21import path from "path";
21import path from "path";
22import Meta from "../components/Meta";
22import Meta from "../components/Meta";
23
23
24+const postReq = (path, params, method='post') => {
25+ const form = document.createElement('form');
26+ form.method = method;
27+ form.action = path;
28+
29+ for (const key in params) {
30+ if (params.hasOwnProperty(key)) {
31+ const hiddenField = document.createElement('input');
32+ hiddenField.type = 'hidden';
33+ hiddenField.name = key;
34+ hiddenField.value = params[key];
35+
36+ form.appendChild(hiddenField);
37+ }
38+ }
39+
40+ document.body.appendChild(form);
41+ form.submit();
42+}
43+
44+
24export default function Home({
45export default function Home({
25 posts,
46 posts,
26 ecosystem,
47 ecosystem,
@@ -52,6 +73,23 @@ export default function Home({
52 {
73 {
53 // Hero
74 // Hero
54 }
75 }
76+ <div className="layout px-4 md:px-8">
77+ <a className="p-8 button-lg bg-green-400 text-white"
78+ onClick={(e) => {
79+ e.stopPropagation();
80+ fetch('https://api.shore.arvo.network/enter', {
81+ method: 'GET',
82+ headers: {'Content-Type': 'application/json'}
83+ })
84+ .then(res => res.json())
85+ .then(data => {
86+ postReq(data.url + '/~/login', {password: data.code, redirect: '/'});
87+ });
88+ }}
89+ >
90+ Try now
91+ </a>
92+ </div>
55 <Section>
93 <Section>
56 <div className="bg-yellow-100 dark:bg-[#5C5037] w-full p-8 md:p-12 rounded-3xl flex flex-col md:flex-row">
94 <div className="bg-yellow-100 dark:bg-[#5C5037] w-full p-8 md:p-12 rounded-3xl flex flex-col md:flex-row">
57 <div className="md:w-10/12 w-full md:mr-6">
95 <div className="md:w-10/12 w-full md:mr-6">