Commit 57ec7f17 authored by minseok.park's avatar minseok.park

login check test

parent 23a8e158
/* eslint-disable no-undef */
'use strict'
let isLogin = false
fetch('web/dms/api/auth/status')
.then((response) => {
console.log('response login >>>>> ', response)
if (!response.ok) {
document.location.href = 'https://swlab.bwg.co.kr/web/dms/home'
}
return response.text()
})
.then((data) => {
console.log(data)
if (data === 'logged_in') {
isLogin = true
}
})
.catch((error) => {
console.error('Error checking login status:', error)
})
module.exports = isLogin
/* eslint-disable no-undef */
;(function () {
'use strict'
fetch('web/dms/api/auth/status')
.then((response) => {
console.log('response login >>>>> ', response)
if (response.url === 'https://swlab.bwg.co.kr/web/dms/login') {
document.location.href = 'https://swlab.bwg.co.kr/web/dms/home'
}
})
.catch((error) => {
console.error('Error checking login status:', error)
})
})()
<header class="header">
<nav class="navbar">
<div class="navbar-brand">
<a class="navbar-item" href="https://swlab.bwg.co.kr/">
{{!-- <a id="logo" class="navbar-item"> --}}
{{#if isLogin}}
<a class="navbar-item" href="https://swlab.bwg.co.kr/web/main">
{{else}}
<a class="navbar-item" href="https://swlab.bwg.co.kr/web/dms/home">
{{/if}}
<i class="navbar-logo"></i>
<div class="navbar-title-contents">
<span class="navbar-title">SWLab</span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment