Skip to content

Instantly share code, notes, and snippets.

@ianjennings
Created June 27, 2020 19:31
Show Gist options
  • Save ianjennings/5d8d505c96235ed57fd0a5d7d6834bb2 to your computer and use it in GitHub Desktop.
Save ianjennings/5d8d505c96235ed57fd0a5d7d6834bb2 to your computer and use it in GitHub Desktop.

These methods come from that routes file that we defined it earlier.

16:59

So it actually understands what's going on here and generates an S Dick.

17:03

Code.exe > routes.js - app - Visual Studio Code

17:03

Four year APP on behalf.

17:06

So when we take a look at

17:10

Where was that? Maybe

17:13

Put C put Account update profile.

17:17

Well, we actually get that method here. Update profile.

17:23

chrome.exe > NEW_APP_NAME - Google Chrome

17:25

If we wanted to create our own Sammy made put Hello, world when we re rendered the S D K when I regenerated it that would show up here as well. We're not gonna do that for right now. But the point is that these are actually dynamically generated by the routes. I think that's super cool.

17:33

Code.exe > routes.js - app - Visual Studio Code

17:42

Okay, So what we're going to do now is we're going to use this update profile to update based on the value here, so let's use cloud.

17:51

Update PROFILE. I think it looks like this with this. You want to do with ramp?

17:53

chrome.exe > NEW_APP_NAME - Google Chrome

17:58

Actually going to do that here in the helo world Run day and hello, world up, Paige.

18:03

Code.exe > routes.js - app - Visual Studio Code

18:05

When is updated So new view update profile with

18:10

We can actually just call that new value.

18:12

See if that works.

18:13

Code.exe > ● hello-world.page.js - app - Visual Studio Code

18:14

No, no. Doesn't like that Cloud update profile with is not a function.

18:16

Commit 00e26415f4ba9756797043edd82e707241a0531f
--- app/assets/js/pages/hello-world.page.js
+++ app/assets/js/pages/hello-world.page.js
@@ -11,6 +11,7 @@ parasails.registerPage('hello-world', {
     me: {
       deep: true,
       handler: function (newValue) {
+        Cloud.updateProfile().with(newValue)
       }
     }
   },

18:21

Okay, Well, maybe we can just

18:23

Code.exe > hello-world.page.js - app - Visual Studio Code

18:24

Maybe it isn't with. Maybe it's just like that.

18:29

Yeah, that was him.

18:31

Commit 0c7f1dcafdff9a47187e17f1f06283d7a25a8ea0
--- app/assets/js/pages/hello-world.page.js
+++ app/assets/js/pages/hello-world.page.js
@@ -11,7 +11,7 @@ parasails.registerPage('hello-world', {
     me: {
       deep: true,
       handler: function (newValue) {
-        Cloud.updateProfile().with(newValue)
+        Cloud.updateProfile(newValue)
       }
     }
   },

18:32

Okay, So are we updating? I think so. But let's just double check.

18:33

chrome.exe > NEW_APP_NAME - Google Chrome

18:37

Oh, you know what it is? I think it's like this. Yeah, Maybe it's like that.

18:43

Code.exe > hello-world.page.js - app - Visual Studio Code

18:43

Yeah. There we go.

18:45

Commit 1770afc47da71c2484351b94e2afc4ed790a4f4a
--- app/assets/js/pages/hello-world.page.js
+++ app/assets/js/pages/hello-world.page.js
@@ -11,7 +11,7 @@ parasails.registerPage('hello-world', {
     me: {
       deep: true,
       handler: function (newValue) {
-        Cloud.updateProfile(newValue)
+        Cloud.updateProfile.with(newValue)
       }
     }
   },

18:45

So I believe that this should be updating the back end.

18:49

When we change things, no.

18:52

Okay, Let's just try this again, so I'm not exactly sure what it wass.

18:53

chrome.exe > NEW_APP_NAME - Google Chrome

18:59

Commit d8bb25892e6f99b713bbdf71f114571ef256f7d4
--- app/assets/js/pages/hello-world.page.js
+++ app/assets/js/pages/hello-world.page.js
@@ -11,7 +11,7 @@ parasails.registerPage('hello-world', {
     me: {
       deep: true,
       handler: function (newValue) {
-        Cloud.updateProfile.with(newValue)
+        Cloud.updateProfile(newValue)
       }
     }
   },

19:00

Listen, double checked out. This is still being

19:03

Code.exe > hello-world.page.js - app - Visual Studio Code

19:03

Still going on here?

19:07

Yes, that's still triggering.

19:08

Commit f466b1edbf383c8a1318ba46d5bf0dfe4f1af8ea
--- app/assets/js/pages/hello-world.page.js
+++ app/assets/js/pages/hello-world.page.js
@@ -11,6 +11,7 @@ parasails.registerPage('hello-world', {
     me: {
       deep: true,
       handler: function (newValue) {
+        console.log('going')
         Cloud.updateProfile(newValue)
       }
     }

19:11

Going to reference the docks. Sales cloud. Um

19:13

chrome.exe > NEW_APP_NAME - Google Chrome

19:17

Update Forget how it is.

19:22

All right sales as clouds decay.

19:23

chrome.exe > sails cloud update - Google Search - Google Chrome

19:28

I need to do and we go. Maybe this will tell us how to do it.

19:32

Yeah, Cloud do something dot with a crowd. Update profile.

19:33

chrome.exe > sailsjs cloud sdk - Google Search - Google Chrome

19:37

With. Okay, Let's make sure let's see if that works.

19:42

Commit a25581bd34b0a4a3d47f8950c75b35627feb83df
--- app/assets/js/pages/hello-world.page.js
+++ app/assets/js/pages/hello-world.page.js
@@ -12,7 +12,7 @@ parasails.registerPage('hello-world', {
       deep: true,
       handler: function (newValue) {
         console.log('going')
-        Cloud.updateProfile(newValue)
+        Cloud.updateProfile.with(newValue)
       }
     }
   },

19:43

chrome.exe > Ration - Google Chrome

19:43

Okay, And we're looking at the network job to meet to see if those requests go through.

19:49

Or not, which was interesting, I think. Oh, I know what we might need him. It's a sink, so we need to do a weight. That's what's problem. Wass.

19:53

chrome.exe > NEW_APP_NAME - Google Chrome

19:57

A weight is only valid in tracing function.

19:59

Commit b592c69d27fd1301ea0300ab3ef967b9c3b3c193
--- app/assets/js/pages/hello-world.page.js
+++ app/assets/js/pages/hello-world.page.js
@@ -12,7 +12,7 @@ parasails.registerPage('hello-world', {
       deep: true,
       handler: function (newValue) {
         console.log('going')
-        Cloud.updateProfile.with(newValue)
+        await Cloud.updateProfile.with(newValue)
       }
     }
   },

20:00

A sink.

20:03

Code.exe > hello-world.page.js - app - Visual Studio Code

20:03

Okay, There we go.

20:06

So now we're updating the profile. We can see the responses Come in here in sales, right? So sales actually receiving those, And when we refresh the page, my name has been changed. So there we go.

20:09

Commit 9f446ee6828a04ac33e83fa1537f388421a95106
--- app/assets/js/pages/hello-world.page.js
+++ app/assets/js/pages/hello-world.page.js
@@ -10,7 +10,7 @@ parasails.registerPage('hello-world', {
   watch: {
     me: {
       deep: true,
-      handler: function (newValue) {
+      handler: async (newValue) => {
         console.log('going')
         await Cloud.updateProfile.with(newValue)
       }

20:13

chrome.exe > NEW_APP_NAME - Google Chrome

20:24

Now. Typically, you wouldn't want to do this on every key press.

20:28

But it demonstrates the persistence, right?

20:33

So that's all I'm going to cover for today.

20:35

That's a basic round loop of how you would render a route, get some info from the database and publish it. Obviously, there's a lot more to learn. Sales comes from comes with a bunch of awesome utilities to do things like Configure your production in staging environments.

20:49

Create Esti Kay's. You can configure this data stores actually on disk, but you can configure to use like reddest or Mangalore. Both translate stuff. Sales is all Sam and I highly recommend it.

20:53

Code.exe > hello-world.page.js - app - Visual Studio Code

21:02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment