Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
portal-apps-manage
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
angular
portal-apps-manage
Commits
b09aa89f
Commit
b09aa89f
authored
Aug 07, 2025
by
sawit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set token
parent
b7dfe12f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
11 deletions
+44
-11
home.component.html
src/app/DPU/home/home.component.html
+7
-7
home.component.ts
src/app/DPU/home/home.component.ts
+11
-2
http-request.interceptor.ts
src/app/shared/services/http-request.interceptor.ts
+2
-2
token.service.ts
src/app/shared/services/token.service.ts
+24
-0
No files found.
src/app/DPU/home/home.component.html
View file @
b09aa89f
...
...
@@ -6,7 +6,7 @@
<div
class=
"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-8"
>
<a
class=
"card bg-white rounded-xl p-8 text-center shadow-lg transition-all duration-300 ease-in-out transform hover:scale-105 hover:shadow-xl hover:bg-gradient-to-br from-blue-50 to-blue-100"
routerLink=
"/myhr-plus/dashboard
"
>
(
click
)="
checkAppToken
('
myhr-plus
')
"
>
<div
class=
"card-icon text-5xl text-indigo-700 mb-4 transition-transform duration-300 ease-in-out group-hover:scale-110"
>
<img
src=
"./assets/images/logoallHR/myhr-plus.jpg"
alt=
"miscrosoft"
class=
"leading-[1.75] text-2xl !h-[5rem] align-middle flex justify-center mx-auto"
>
...
...
@@ -16,7 +16,7 @@
</a>
<a
class=
"card bg-white rounded-xl p-8 text-center shadow-lg transition-all duration-300 ease-in-out transform hover:scale-105 hover:shadow-xl hover:bg-gradient-to-br from-blue-50 to-blue-100"
routerLink=
"/myhr-lite/dashboard
"
>
(
click
)="
checkAppToken
('
myhr-lite
')
"
>
<div
class=
"card-icon text-5xl text-indigo-700 mb-4 transition-transform duration-300 ease-in-out group-hover:scale-110"
>
<img
src=
"./assets/images/logoallHR/myHR-Lite-logo-new.png"
alt=
"miscrosoft"
class=
"leading-[1.75] text-2xl !h-[5rem] align-middle flex justify-center mx-auto"
>
...
...
@@ -26,7 +26,7 @@
</a>
<a
class=
"card bg-white rounded-xl p-8 text-center shadow-lg transition-all duration-300 ease-in-out transform hover:scale-105 hover:shadow-xl hover:bg-gradient-to-br from-blue-50 to-blue-100"
routerLink=
"/zeeme/dashboard
"
>
(
click
)="
checkAppToken
('
zeeme
')
"
>
<div
class=
"card-icon text-5xl text-indigo-700 mb-4 transition-transform duration-300 ease-in-out group-hover:scale-110"
>
<img
src=
"./assets/images/logoallHR/zeemePlus.png"
alt=
"miscrosoft"
class=
"leading-[1.75] text-2xl !h-[5rem] align-middle flex justify-center mx-auto"
>
...
...
@@ -36,7 +36,7 @@
</a>
<a
class=
"card bg-white rounded-xl p-8 text-center shadow-lg transition-all duration-300 ease-in-out transform hover:scale-105 hover:shadow-xl hover:bg-gradient-to-br from-blue-50 to-blue-100"
routerLink=
"/myface/dashboard
"
>
(
click
)="
checkAppToken
('
myface
')
"
>
<div
class=
"card-icon text-5xl text-indigo-700 mb-4 transition-transform duration-300 ease-in-out group-hover:scale-110"
>
<img
src=
"./assets/images/logoallHR/logo_myface.png"
alt=
"miscrosoft"
class=
"leading-[1.75] text-2xl !h-[5rem] align-middle flex justify-center mx-auto"
>
...
...
@@ -46,7 +46,7 @@
</a>
<a
class=
"card bg-white rounded-xl p-8 text-center shadow-lg transition-all duration-300 ease-in-out transform hover:scale-105 hover:shadow-xl hover:bg-gradient-to-br from-blue-50 to-blue-100"
routerLink=
"/mylearn/mylearn-pdpa-manage
"
>
(
click
)="
checkAppToken
('
mylearn
')
"
>
<div
class=
"card-icon text-5xl text-indigo-700 mb-4 transition-transform duration-300 ease-in-out group-hover:scale-110"
>
<img
src=
"./assets/images/logoallHR/mylearn-logo.png"
alt=
"miscrosoft"
class=
"leading-[1.75] text-2xl !h-[5rem] align-middle flex justify-center mx-auto"
>
...
...
@@ -56,7 +56,7 @@
</a>
<a
class=
"card bg-white rounded-xl p-8 text-center shadow-lg transition-all duration-300 ease-in-out transform hover:scale-105 hover:shadow-xl hover:bg-gradient-to-br from-blue-50 to-blue-100"
routerLink=
"/myjob/pdpa-manage
"
>
(
click
)="
checkAppToken
('
myjob
')
"
>
<div
class=
"card-icon text-5xl text-indigo-700 mb-4 transition-transform duration-300 ease-in-out group-hover:scale-110"
>
<img
src=
"./assets/images/logoallHR/logo_myjob.png"
alt=
"miscrosoft"
class=
"leading-[1.75] text-2xl !h-[5rem] align-middle flex justify-center mx-auto"
>
...
...
@@ -66,7 +66,7 @@
</a>
<a
class=
"card bg-white rounded-xl p-8 text-center shadow-lg transition-all duration-300 ease-in-out transform hover:scale-105 hover:shadow-xl hover:bg-gradient-to-br from-blue-50 to-blue-100"
routerLink=
"/myskill-x/portal-category-list
"
>
(
click
)="
checkAppToken
('
myskill-x
')
"
>
<div
class=
"card-icon text-5xl text-indigo-700 mb-4 transition-transform duration-300 ease-in-out group-hover:scale-110"
>
<img
src=
"./assets/images/logoallHR/mySkill-x.png"
alt=
"miscrosoft"
class=
"leading-[1.75] text-2xl !h-[5rem] align-middle flex justify-center mx-auto"
>
...
...
src/app/DPU/home/home.component.ts
View file @
b09aa89f
import
{
Component
}
from
'@angular/core'
;
import
{
Router
,
RouterLink
}
from
'@angular/router'
;
import
{
TokenService
}
from
'../../shared/services/token.service'
;
@
Component
({
selector
:
'app-home'
,
templateUrl
:
'./home.component.html'
,
styleUrls
:
[
'./home.component.scss'
],
standalone
:
true
,
imports
:
[
RouterLink
]
//
imports: [RouterLink]
})
export
class
HomeComponent
{
constructor
(
private
router
:
Router
)
{
}
constructor
(
private
router
:
Router
,
private
tokenService
:
TokenService
,
)
{
}
logout
()
{
localStorage
.
removeItem
(
'authToken'
);
// Clear the authentication token
this
.
router
.
navigate
([
'/auth/login'
]);
// Navigate to the login page
}
checkAppToken
(
appmodule
:
string
){
this
.
tokenService
.
saveAppToken
(
appmodule
)
this
.
router
.
navigate
([
'/'
+
appmodule
])
}
}
src/app/shared/services/http-request.interceptor.ts
View file @
b09aa89f
...
...
@@ -32,8 +32,8 @@ export class HttpRequestInterceptor {
// ใช้ fixed token หาก url เป็น portal.myhr.co.th
if
(
fullUrl
.
startsWith
(
environment
.
url
))
{
token
=
`Bearer
${
environment
.
portalFixedToken
}
`
;
}
else
if
(
this
.
tokenService
.
getToken
())
{
token
=
`Bearer
${
this
.
tokenService
.
getToken
()}
`
;
}
else
if
(
this
.
tokenService
.
get
App
Token
())
{
token
=
`Bearer
${
this
.
tokenService
.
get
App
Token
()}
`
;
}
let
authReq
=
req
.
clone
({
url
:
fullUrl
});
...
...
src/app/shared/services/token.service.ts
View file @
b09aa89f
...
...
@@ -5,9 +5,11 @@ import { jwtDecode } from "jwt-decode";
import
{
ProfileModel
,
UserModel
}
from
"../user-auth.model"
;
import
{
UserProfileModel
}
from
"../../DPU/models/user.model"
;
import
{
CompanyModel
}
from
"../../DPU/models/company.model"
;
import
{
environment
}
from
"../../../environments/environment"
;
// import jwt_decode from "jwt-decode";
const
TOKEN_KEY
=
'auth-token'
;
const
APP_TOKEN_KEY
=
'app-token'
;
const
REFRESHTOKEN_KEY
=
'auth-refreshtoken'
;
const
USER_KEY
=
'auth-user'
;
const
USER_DATA_KEY
=
'auth-user-data'
;
...
...
@@ -17,6 +19,18 @@ const COMPANY = 'company';
providedIn
:
"root"
,
})
export
class
TokenService
{
static
getAppTokenModule
(
arg0
:
string
)
{
throw
new
Error
(
'Method not implemented.'
);
}
apptoken
:
any
=
{
"myhr-plus"
:
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJB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TM01n1g4XpFyuAa3VPxOozNPnJ0mu7kxU6KUs"
,
"myskill-x"
:
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBdXRoIiwidWlkIjoiOGFhNDUzMzAtMzE0Yy0xMWU3LWJhZjMtMmQ3ZDA5ODc3NzQ0Iiwicm9sZXMiOlsiYWRtaW4iXSwiaXNzIjoiQ29tcHV0ZXIgU2NpZW5jZSBDb3Jwb3JhdGlvbiBMaW1pdGVkIiwidXNlcm5hbWUiOiJhZG1pbiJ9.Um39_CTM01n1g4XpFyuAa3VPxOozNPnJ0mu7kxU6KUs"
,
}
constructor
(
private
router
:
Router
)
{
}
signOut
():
void
{
...
...
@@ -90,4 +104,14 @@ export class TokenService {
return
new
CompanyModel
();
}
public
saveAppToken
(
module
:
string
):
void
{
let
tokenkey
=
this
.
apptoken
[
module
]
window
.
localStorage
.
removeItem
(
APP_TOKEN_KEY
);
window
.
localStorage
.
setItem
(
APP_TOKEN_KEY
,
tokenkey
);
}
public
getAppToken
():
string
|
null
{
return
window
.
localStorage
.
getItem
(
APP_TOKEN_KEY
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment