pouch-vue icon indicating copy to clipboard operation
pouch-vue copied to clipboard

request: an example to demonstrate editing a single item

Open BananaAcid opened this issue 5 years ago • 3 comments

The current examples are fine, but talking to two other friends of mine, they seem to have the same problem: how to build a todo app, where the editing is using another view (passing the doc._id).

Another thing: The auth examples shows two code blocks - but no explanation where/how to use them. I know, it is probably super clear for a pro using this plugin for a while, but not for beginners with this plugin.

Would be great if you could see to this, as I believe it would make it easier to get going with it.

btw, using framework7.io/vue - building a PWA

BananaAcid avatar Jun 21 '19 23:06 BananaAcid

That's a great idea. If I have time or someone else does maybe we can get some fully worked out examples put up here.

As for immediately, the Boatnet project might interest you: https://github.com/nwfsc-fram/boatnet

They're using pouch-vue in their PWA.

assemblethis avatar Jun 23 '19 03:06 assemblethis

went with (maybe as a starting point)

       {
		pouch: {

			item() {
				const self = this;
				return {
					database: 'items',
					selector: {_id: self.$f7route.params.id}, // the view used the Framework7 router to receive the item._id
					first: true // returns a single item (not the usual array of items)
				}
			}

		},
         }

need to wait for the item to be populated, v-if will only show if it is there

		<div v-if="!item">
                 loading, please wait ...
                </div>

		<div v-if="item">
                 Item JSON: {{item}}
                </div>

BananaAcid avatar Jun 23 '19 22:06 BananaAcid

Hey, thanks for the feedback! Those code snippets were initially just for reference on an internal project. I agree that there is a need for more context on the topic. The login example will generally help you sign in to your pwa leading the user to another page, something like a dashboard. The session example will be called on all "protected" routes making sure the user is signed in otherwise redirecting to the login view.

MDSLKTR avatar Jun 24 '19 14:06 MDSLKTR