콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
2657 화면

I was wondering if I can test if a user is logged in in the Javascript frontend?
I don't need the user ID, just that a user has logged in.

아바타
취소
작성자 베스트 답변

I worked it out:
odoo.define('something', function(require){
  var session = require("session");
  if (session.user_id !== false) console.log('User logged in')
});

아바타
취소

it think it needs to be like this:
var session = require("web.session");

you need to write web.session in required statement.
thank you for your answer.