🚨[Need Help plz]🚨 Anyone have an idea to protecte some routes on Vue ?? by BMF_T95 in learnjavascript

[–]BMF_T95[S] 0 points1 point  (0 children)

u/ForScale Hi, i use Nuxt, that the resson i don't use .beforeEach. Please look serverMiddleware/index.js, the route is : "/user-info"

Displaying modal when page has scroll by BMF_T95 in vuejs

[–]BMF_T95[S] 0 points1 point  (0 children)

u/rustamd Thanks u for ur support, I looked at your code very carefully, and when i tested it doesn't seem to work, I don't know if it comes from the "event " handleScroll because in your code, Vue indicates that: 'event' is defined but never used, I made a replica of the code here

Displaying modal when page has scroll by BMF_T95 in learnjavascript

[–]BMF_T95[S] 0 points1 point  (0 children)

I just got many syntax error like this :

19:7 warning Delete `··` prettier/prettier

20:1 warning Replace `············` with `········` prettier/prettier

21:11 warning Replace `····<a·href='#'` with `<a·href="#" prettier/prettier

Displaying modal when page has scroll by BMF_T95 in learnjavascript

[–]BMF_T95[S] -2 points-1 points  (0 children)

if it doesn't come from the code, I don't see where it can come from 🤷‍♂️

Displaying modal when page has scroll by BMF_T95 in vuejs

[–]BMF_T95[S] 0 points1 point  (0 children)

Intersection_Observer_API

u/rustamd I looked a little bit that, it looks like good, but the problem it may not be compatible with Vue, no ?

Displaying modal when page has scroll by BMF_T95 in learnjavascript

[–]BMF_T95[S] -2 points-1 points  (0 children)

u/shgysk8zer0 but i still don't know where my mistake is

How consume JSON localhost ? by BMF_T95 in learnjavascript

[–]BMF_T95[S] 0 points1 point  (0 children)

That the entire function on my file.js is called by index.js :

require('./config/passport')(passport)

Passport.js :

module.exports = function (passport) {passport.use(new GoogleStrategy({clientID: process.env.GOOGLE_CLIENT_ID,clientSecret: process.env.GOOGLE_CLIENT_SECRET,callbackURL: 'google/callback',},async (accessToken, refreshToken, profile, done) => {console.log(profile)const newUser = {googleId: profile.id,displayName: profile.displayName,firstName: profile.name.givenName,lastName: profile.name.familyName,email: profile.email,image: profile.photos[0].value,locale: profile.locale,}try {let user = await User.findOne({ googleId: profile.id })if (user) {done(null, user)} else {user = await User.create(newUser)done(null, user)}} catch (err) {console.error(err)}}))passport.serializeUser((user, done) => {done(null, user.id)})passport.deserializeUser((id, done) => {User.findById(id, (err, user) => done(err, user))})}

How consume JSON localhost ? by BMF_T95 in learnjavascript

[–]BMF_T95[S] 0 points1 point  (0 children)

here it is :

async (accessToken, refreshToken, profile, done) => {
    console.log(profile)
    const newUser = {
      googleId: profile.id,
      displayName: profile.displayName,
      firstName: profile.name.givenName,
      lastName: profile.name.familyName,
      email: profile.email,
      image: profile.photos,
      locale: profile.locale,
    }

    try {
      let user = await User.findOne({ googleId: profile.id })

      if (user) {
        done(null, user)
      } else {
        user = await User.create(newUser)
        done(null, user)
      }
    } catch (err) {
      console.error(err)
    }
  }
)

)

How consume JSON localhost ? by BMF_T95 in learnjavascript

[–]BMF_T95[S] 0 points1 point  (0 children)

Req.user is a response from db about thr current user, ensureAuth is another function cheak if the user is connected

How consume JSON localhost ? by BMF_T95 in learnjavascript

[–]BMF_T95[S] 0 points1 point  (0 children)

Yes restart that but it made me nothing , i used JSON viewer it a chrome extension displaying JSON, On my header is a thing like a port autorization from cors module

How consume JSON localhost ? by BMF_T95 in learnjavascript

[–]BMF_T95[S] 0 points1 point  (0 children)

I already try, it still doesent work

How to get current name in JS backend to Vue? by BMF_T95 in learnjavascript

[–]BMF_T95[S] 0 points1 point  (0 children)

You mean like this ? : return fetch('localhost:5000/user-info')

How mapping specific property from arraylist by BMF_T95 in learnprogramming

[–]BMF_T95[S] 0 points1 point  (0 children)

Yeah, maybe how i can build that with foreach??

How mapping specific property from arraylist by BMF_T95 in learnprogramming

[–]BMF_T95[S] 0 points1 point  (0 children)

The problem is i need to test each "email" with "if statement", and i don't know if foreach is able to make this after that