Enrutador
This commit is contained in:
parent
ade8500740
commit
9330311d95
@ -6,16 +6,19 @@
|
|||||||
|
|
||||||
meteor-base@1.5.2 # Packages every Meteor app needs to have
|
meteor-base@1.5.2 # Packages every Meteor app needs to have
|
||||||
mobile-experience@1.1.2 # Packages for a great mobile UX
|
mobile-experience@1.1.2 # Packages for a great mobile UX
|
||||||
mongo@2.0.2 # The database Meteor supports right now
|
mongo@2.0.3-rc310.0 # The database Meteor supports right now
|
||||||
reactive-var@1.0.13 # Reactive variable for tracker
|
reactive-var@1.0.13 # Reactive variable for tracker
|
||||||
|
|
||||||
standard-minifier-css@1.9.3 # CSS minifier run for production mode
|
standard-minifier-css@1.9.3 # CSS minifier run for production mode
|
||||||
standard-minifier-js@3.0.0 # JS minifier run for production mode
|
standard-minifier-js@3.0.0 # JS minifier run for production mode
|
||||||
es5-shim@4.8.1 # ECMAScript 5 compatibility for older browsers
|
es5-shim@4.8.1 # ECMAScript 5 compatibility for older browsers
|
||||||
ecmascript@0.16.9 # Enable ECMAScript2015+ syntax in app code
|
ecmascript@0.16.10-rc310.0 # Enable ECMAScript2015+ syntax in app code
|
||||||
typescript@5.4.3 # Enable TypeScript syntax in .ts and .tsx modules
|
typescript@5.6.3-rc310.0 # Enable TypeScript syntax in .ts and .tsx modules
|
||||||
shell-server@0.6.0 # Server-side component of the `meteor shell` command
|
shell-server@0.6.1-rc310.0 # Server-side component of the `meteor shell` command
|
||||||
hot-module-replacement@0.5.4 # Update client in development without reloading the page
|
hot-module-replacement@0.5.4 # Update client in development without reloading the page
|
||||||
|
|
||||||
static-html@1.4.0 # Define static page content in .html files
|
static-html@1.4.0 # Define static page content in .html files
|
||||||
react-meteor-data # React higher-order component for reactively tracking Meteor data
|
react-meteor-data # React higher-order component for reactively tracking Meteor data
|
||||||
|
roles@1.0.0-rc310.0
|
||||||
|
accounts-password@3.0.3-rc310.0
|
||||||
|
react-meteor-accounts
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
METEOR@3.0.4
|
METEOR@3.1-rc.0
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
|
accounts-base@3.0.3
|
||||||
|
accounts-password@3.0.3-rc310.0
|
||||||
allow-deny@2.0.0
|
allow-deny@2.0.0
|
||||||
autoupdate@2.0.0
|
autoupdate@2.0.0
|
||||||
babel-compiler@7.11.1
|
babel-compiler@7.11.2-rc310.0
|
||||||
babel-runtime@1.5.2
|
babel-runtime@1.5.2
|
||||||
base64@1.0.13
|
base64@1.0.13
|
||||||
binary-heap@1.0.12
|
binary-heap@1.0.12
|
||||||
@ -10,16 +12,18 @@ callback-hook@1.6.0
|
|||||||
check@1.4.4
|
check@1.4.4
|
||||||
core-runtime@1.0.0
|
core-runtime@1.0.0
|
||||||
ddp@1.4.2
|
ddp@1.4.2
|
||||||
ddp-client@3.0.2
|
ddp-client@3.0.3-rc310.0
|
||||||
ddp-common@1.4.4
|
ddp-common@1.4.4
|
||||||
ddp-server@3.0.2
|
ddp-rate-limiter@1.2.2
|
||||||
|
ddp-server@3.0.3-rc310.0
|
||||||
diff-sequence@1.1.3
|
diff-sequence@1.1.3
|
||||||
dynamic-import@0.7.4
|
dynamic-import@0.7.4
|
||||||
ecmascript@0.16.9
|
ecmascript@0.16.10-rc310.0
|
||||||
ecmascript-runtime@0.8.3
|
ecmascript-runtime@0.8.3
|
||||||
ecmascript-runtime-client@0.12.2
|
ecmascript-runtime-client@0.12.2
|
||||||
ecmascript-runtime-server@0.11.1
|
ecmascript-runtime-server@0.11.1
|
||||||
ejson@1.1.4
|
ejson@1.1.4
|
||||||
|
email@3.1.1-rc310.0
|
||||||
es5-shim@4.8.1
|
es5-shim@4.8.1
|
||||||
facts-base@1.0.2
|
facts-base@1.0.2
|
||||||
fetch@0.1.5
|
fetch@0.1.5
|
||||||
@ -29,40 +33,46 @@ hot-module-replacement@0.5.4
|
|||||||
id-map@1.2.0
|
id-map@1.2.0
|
||||||
inter-process-messaging@0.1.2
|
inter-process-messaging@0.1.2
|
||||||
launch-screen@2.0.1
|
launch-screen@2.0.1
|
||||||
|
localstorage@1.2.1
|
||||||
logging@1.3.5
|
logging@1.3.5
|
||||||
meteor@2.0.1
|
meteor@2.0.2-rc310.0
|
||||||
meteor-base@1.5.2
|
meteor-base@1.5.2
|
||||||
minifier-css@2.0.0
|
minifier-css@2.0.0
|
||||||
minifier-js@3.0.0
|
minifier-js@3.0.1-rc310.0
|
||||||
minimongo@2.0.1
|
minimongo@2.0.2-rc310.0
|
||||||
mobile-experience@1.1.2
|
mobile-experience@1.1.2
|
||||||
mobile-status-bar@1.1.1
|
mobile-status-bar@1.1.1
|
||||||
modern-browsers@0.1.11
|
modern-browsers@0.1.11
|
||||||
modules@0.20.2
|
modules@0.20.3-rc310.0
|
||||||
modules-runtime@0.13.2
|
modules-runtime@0.13.2
|
||||||
modules-runtime-hot@0.14.3
|
modules-runtime-hot@0.14.3
|
||||||
mongo@2.0.2
|
mongo@2.0.3-rc310.0
|
||||||
mongo-decimal@0.1.4
|
mongo-decimal@0.2.0
|
||||||
mongo-dev-server@1.1.1
|
mongo-dev-server@1.1.1
|
||||||
mongo-id@1.0.9
|
mongo-id@1.0.9
|
||||||
npm-mongo@4.17.4
|
npm-mongo@6.10.0-rc310.0
|
||||||
ordered-dict@1.2.0
|
ordered-dict@1.2.0
|
||||||
promise@1.0.0
|
promise@1.0.0
|
||||||
random@1.2.2
|
random@1.2.2
|
||||||
|
rate-limit@1.1.2
|
||||||
react-fast-refresh@0.2.9
|
react-fast-refresh@0.2.9
|
||||||
|
react-meteor-accounts@1.0.3
|
||||||
react-meteor-data@3.0.2
|
react-meteor-data@3.0.2
|
||||||
reactive-var@1.0.13
|
reactive-var@1.0.13
|
||||||
reload@1.3.2
|
reload@1.3.2
|
||||||
retry@1.1.1
|
retry@1.1.1
|
||||||
|
roles@1.0.0-rc310.0
|
||||||
routepolicy@1.1.2
|
routepolicy@1.1.2
|
||||||
shell-server@0.6.0
|
sha@1.0.10
|
||||||
|
shell-server@0.6.1-rc310.0
|
||||||
socket-stream-client@0.5.3
|
socket-stream-client@0.5.3
|
||||||
standard-minifier-css@1.9.3
|
standard-minifier-css@1.9.3
|
||||||
standard-minifier-js@3.0.0
|
standard-minifier-js@3.0.0
|
||||||
static-html@1.4.0
|
static-html@1.4.0
|
||||||
static-html-tools@1.0.0
|
static-html-tools@1.0.0
|
||||||
tracker@1.3.4
|
tracker@1.3.4
|
||||||
typescript@5.4.3
|
typescript@5.6.3-rc310.0
|
||||||
underscore@1.6.4
|
url@1.3.4
|
||||||
webapp@2.0.3
|
webapp@2.0.4-rc310.0
|
||||||
webapp-hashing@1.1.2
|
webapp-hashing@1.1.2
|
||||||
|
zodern:types@1.0.13
|
||||||
|
|||||||
2013
.vscode/typings/meteor.d.ts
vendored
Normal file
2013
.vscode/typings/meteor.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,18 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Hello } from './Hello.jsx';
|
import { Hello } from './Hello.jsx';
|
||||||
import { Info } from './Info.jsx';
|
import { Info } from './Info.jsx';
|
||||||
|
import { BrowserRouter, Routes, Route, Link } from 'react-router-dom';
|
||||||
|
|
||||||
export const App = () => (
|
export const App = () => (
|
||||||
<div>
|
<BrowserRouter>
|
||||||
<h1>Welcome to Meteor!</h1>
|
<Routes>
|
||||||
<Hello/>
|
<Route path="/" element={ <>
|
||||||
<Info/>
|
<div>
|
||||||
</div>
|
<h1>Welcome to Meteor!</h1>
|
||||||
|
<Hello/>
|
||||||
|
<Info/>
|
||||||
|
</div>
|
||||||
|
</>} />
|
||||||
|
</Routes>
|
||||||
|
</BrowserRouter>
|
||||||
);
|
);
|
||||||
|
|||||||
80
imports/ui/Login.tsx
Normal file
80
imports/ui/Login.tsx
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import { Accounts } from 'meteor/accounts-base';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import { Meteor } from 'meteor/meteor';
|
||||||
|
|
||||||
|
|
||||||
|
export const Login= () => {
|
||||||
|
const [isLogin, setIsLogin] = useState( { initialState: true } );
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const handleLogin = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
console.dir(e);
|
||||||
|
console.dir(e.target.elements.email.value);
|
||||||
|
// console.dir(e.target.elements.password.value);
|
||||||
|
const email = e.target.elements.email.value;
|
||||||
|
const password = e.target.elements.password.value;
|
||||||
|
|
||||||
|
Meteor.loginWithPassword(email, password, (err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
} else {
|
||||||
|
navigate('/');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleRegistration = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
console.dir(e);
|
||||||
|
const username = e.target.elements.username.value;
|
||||||
|
const email = e.target.elements.email.value;
|
||||||
|
const password = e.target.elements.password.value;
|
||||||
|
const password2 = e.target.elements.password2.value;
|
||||||
|
|
||||||
|
if (password !== password2) {
|
||||||
|
console.error("Passwords do not match!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Accounts.createUserAsync({
|
||||||
|
username,
|
||||||
|
email,
|
||||||
|
password
|
||||||
|
}).then(() => navigate('/'))
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isLogin) {
|
||||||
|
return <form onSubmit={handleLogin}>
|
||||||
|
<label htmlFor="email">E-mail</label>
|
||||||
|
<input id="email" type="email" required />
|
||||||
|
<br />
|
||||||
|
<label htmlFor="password">Password</label>
|
||||||
|
<input id="password" type="password" required />
|
||||||
|
<br />
|
||||||
|
<button type="submit">Login</button>
|
||||||
|
<button onClick={() => setIsLogin( false )}>Register a new account</button>
|
||||||
|
</form>
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<form onSubmit={handleRegistration}>
|
||||||
|
<label htmlFor="username">Username</label>
|
||||||
|
<input id="username" type="text" required />
|
||||||
|
<br />
|
||||||
|
<label htmlFor="email">E-mail</label>
|
||||||
|
<input id="email" type="email" required />
|
||||||
|
<br />
|
||||||
|
<label htmlFor="password">Password</label>
|
||||||
|
<input id="password" type="password" required />
|
||||||
|
<br />
|
||||||
|
<label htmlFor="password2">Repeat password</label>
|
||||||
|
<input id="password2" type="password" required />
|
||||||
|
<br />
|
||||||
|
<button type="submit">Register</button>
|
||||||
|
<button onClick={() => setIsLogin( true )}>Login instead</button>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
};
|
||||||
19
imports/ui/Logout.tsx
Normal file
19
imports/ui/Logout.tsx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import React, { type FC } from 'react';
|
||||||
|
import { Meteor } from 'meteor/meteor';
|
||||||
|
import { useUserId } from 'meteor/react-meteor-accounts';
|
||||||
|
|
||||||
|
export const Logout: FC = () => {
|
||||||
|
const userId = useUserId();
|
||||||
|
|
||||||
|
if (!userId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Meteor.logout();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<h1>See you later!</h1>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
44
package-lock.json
generated
44
package-lock.json
generated
@ -9,7 +9,8 @@
|
|||||||
"@babel/runtime": "^7.20.7",
|
"@babel/runtime": "^7.20.7",
|
||||||
"meteor-node-stubs": "^1.2.5",
|
"meteor-node-stubs": "^1.2.5",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0",
|
||||||
|
"react-router-dom": "^6.28.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/runtime": {
|
"node_modules/@babel/runtime": {
|
||||||
@ -24,6 +25,15 @@
|
|||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@remix-run/router": {
|
||||||
|
"version": "1.21.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.21.0.tgz",
|
||||||
|
"integrity": "sha512-xfSkCAchbdG5PnbrKqFWwia4Bi61nH+wm8wLEqfHDyp7Y3dZzgqS2itV8i4gAq9pC2HsTpwyBC6Ds8VHZ96JlA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/js-tokens": {
|
"node_modules/js-tokens": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||||
@ -1236,6 +1246,38 @@
|
|||||||
"react": "^18.3.1"
|
"react": "^18.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-router": {
|
||||||
|
"version": "6.28.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.28.0.tgz",
|
||||||
|
"integrity": "sha512-HrYdIFqdrnhDw0PqG/AKjAqEqM7AvxCz0DQ4h2W8k6nqmc5uRBYDag0SBxx9iYz5G8gnuNVLzUe13wl9eAsXXg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@remix-run/router": "1.21.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">=16.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/react-router-dom": {
|
||||||
|
"version": "6.28.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.28.0.tgz",
|
||||||
|
"integrity": "sha512-kQ7Unsl5YdyOltsPGl31zOjLrDv+m2VcIEcIHqYYD3Lp0UppLjrzcfJqDJwXxFw3TH/yvapbnUvPlAj7Kx5nbg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@remix-run/router": "1.21.0",
|
||||||
|
"react-router": "6.28.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">=16.8",
|
||||||
|
"react-dom": ">=16.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/regenerator-runtime": {
|
"node_modules/regenerator-runtime": {
|
||||||
"version": "0.14.1",
|
"version": "0.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
|
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
|
||||||
|
|||||||
@ -11,7 +11,8 @@
|
|||||||
"@babel/runtime": "^7.20.7",
|
"@babel/runtime": "^7.20.7",
|
||||||
"meteor-node-stubs": "^1.2.5",
|
"meteor-node-stubs": "^1.2.5",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0",
|
||||||
|
"react-router-dom": "^6.28.0"
|
||||||
},
|
},
|
||||||
"meteor": {
|
"meteor": {
|
||||||
"mainModule": {
|
"mainModule": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user