This commit is contained in:
Pasq G 2024-11-22 14:17:29 +01:00
parent 4b577f9094
commit 1f1ff5c2cd
5 changed files with 41 additions and 26 deletions

View File

@ -6,19 +6,19 @@
meteor-base@1.5.2 # Packages every Meteor app needs to have
mobile-experience@1.1.2 # Packages for a great mobile UX
mongo@2.0.3-rc310.0 # The database Meteor supports right now
mongo@2.0.3 # The database Meteor supports right now
reactive-var@1.0.13 # Reactive variable for tracker
standard-minifier-css@1.9.3 # CSS 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
ecmascript@0.16.10-rc310.0 # Enable ECMAScript2015+ syntax in app code
typescript@5.6.3-rc310.0 # Enable TypeScript syntax in .ts and .tsx modules
shell-server@0.6.1-rc310.0 # Server-side component of the `meteor shell` command
ecmascript@0.16.10 # Enable ECMAScript2015+ syntax in app code
typescript@5.6.3 # Enable TypeScript syntax in .ts and .tsx modules
shell-server@0.6.1 # Server-side component of the `meteor shell` command
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
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
roles@1.0.0
accounts-password@3.0.3
react-meteor-accounts

View File

@ -1 +1 @@
METEOR@3.1-rc.0
METEOR@3.1

View File

@ -1,8 +1,8 @@
accounts-base@3.0.3
accounts-password@3.0.3-rc310.0
accounts-password@3.0.3
allow-deny@2.0.0
autoupdate@2.0.0
babel-compiler@7.11.2-rc310.0
babel-compiler@7.11.2
babel-runtime@1.5.2
base64@1.0.13
binary-heap@1.0.12
@ -12,18 +12,18 @@ callback-hook@1.6.0
check@1.4.4
core-runtime@1.0.0
ddp@1.4.2
ddp-client@3.0.3-rc310.0
ddp-client@3.0.3
ddp-common@1.4.4
ddp-rate-limiter@1.2.2
ddp-server@3.0.3-rc310.0
ddp-server@3.0.3
diff-sequence@1.1.3
dynamic-import@0.7.4
ecmascript@0.16.10-rc310.0
ecmascript@0.16.10
ecmascript-runtime@0.8.3
ecmascript-runtime-client@0.12.2
ecmascript-runtime-server@0.11.1
ejson@1.1.4
email@3.1.1-rc310.0
email@3.1.1
es5-shim@4.8.1
facts-base@1.0.2
fetch@0.1.5
@ -35,22 +35,22 @@ inter-process-messaging@0.1.2
launch-screen@2.0.1
localstorage@1.2.1
logging@1.3.5
meteor@2.0.2-rc310.0
meteor@2.0.2
meteor-base@1.5.2
minifier-css@2.0.0
minifier-js@3.0.1-rc310.0
minimongo@2.0.2-rc310.0
minifier-js@3.0.1
minimongo@2.0.2
mobile-experience@1.1.2
mobile-status-bar@1.1.1
modern-browsers@0.1.11
modules@0.20.3-rc310.0
modules@0.20.3
modules-runtime@0.13.2
modules-runtime-hot@0.14.3
mongo@2.0.3-rc310.0
mongo@2.0.3
mongo-decimal@0.2.0
mongo-dev-server@1.1.1
mongo-id@1.0.9
npm-mongo@6.10.0-rc310.0
npm-mongo@6.10.0
ordered-dict@1.2.0
promise@1.0.0
random@1.2.2
@ -61,18 +61,18 @@ react-meteor-data@3.0.2
reactive-var@1.0.13
reload@1.3.2
retry@1.1.1
roles@1.0.0-rc310.0
roles@1.0.0
routepolicy@1.1.2
sha@1.0.10
shell-server@0.6.1-rc310.0
shell-server@0.6.1
socket-stream-client@0.5.3
standard-minifier-css@1.9.3
standard-minifier-js@3.0.0
static-html@1.4.0
static-html-tools@1.0.0
tracker@1.3.4
typescript@5.6.3-rc310.0
url@1.3.4
webapp@2.0.4-rc310.0
typescript@5.6.3
url@1.3.5
webapp@2.0.4
webapp-hashing@1.1.2
zodern:types@1.0.13

View File

@ -35,7 +35,10 @@ const Pobles = () => {
<label htmlFor="nomPoble">Població: </label><input name="nomPoble" type="text" defaultValue={pobleSeleccionat.nomPoble}/><br />
<label htmlFor="comarca">Comarca: </label><input name="comarca" type="text" /><br />
<label htmlFor="cp">Codi Postal: </label><input name="cp" type="text" /><br />
<input type='submit' value="Crear la Població" />
<input type='submit' value="Actualitzar la Població" />
<button onClick={() => {
Meteor.callAsync('eliminaPoble', pobleSeleccionat._id).catch(err => console.error(err));
}}>Elimina</button>
</form></>;
};
@ -45,7 +48,7 @@ const Pobles = () => {
<ul>{
pobles
.sort((a,b) => a.nomPoble.toLowerCase() > b.nomPoble.toLowerCase())
.map(pob => <li key={`pob_${pob._id}`}>{pob.nomPoble}<button onClick={() => {setPobleSeleccionat(pob)}}>Edita</button><button>&times;</button></li>)
.map(pob => <li key={`pob_${pob._id}`}>{pob.nomPoble}<button onClick={() => {setPobleSeleccionat(pob)}}>Edita</button></li>)
}</ul>
</Suspense>;
};

View File

@ -196,6 +196,18 @@ Meteor.startup(async () => {
} catch (e) {
console.error(e);
}
},
'eliminaPoble': async function (pobleId) {
try {
if (pobleId) {
return await PoblesCollection.removeAsync(pobleId);
} else {
throw new Error("El nom del poble no és vàlid");
}
} catch (e) {
console.error(e);
}
}
});