Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
myjob-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
myjob-manage
Commits
9aadc9ca
Commit
9aadc9ca
authored
Jul 14, 2025
by
Natthaphat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ปิดไม่ให้กรอก ID
parent
00d8b8af
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
175 additions
and
20 deletions
+175
-20
admin-manage.component.ts
src/app/DPU/common/admin-manage/admin-manage.component.ts
+9
-10
user-setting.component.html
.../user-management/user-setting/user-setting.component.html
+2
-2
user-setting.component.ts
...on/user-management/user-setting/user-setting.component.ts
+1
-3
auth.model.ts
src/app/DPU/models/auth.model.ts
+4
-0
profile.model.ts
src/app/DPU/models/profile.model.ts
+16
-5
admin.service.ts
src/app/DPU/services/admin.service.ts
+137
-0
user.service.ts
src/app/DPU/services/user.service.ts
+6
-0
No files found.
src/app/DPU/common/admin-manage/admin-manage.component.ts
View file @
9aadc9ca
...
@@ -7,11 +7,11 @@ import swal from 'sweetalert';
...
@@ -7,11 +7,11 @@ import swal from 'sweetalert';
import
{
MatPaginator
,
PageEvent
}
from
"@angular/material/paginator"
;
import
{
MatPaginator
,
PageEvent
}
from
"@angular/material/paginator"
;
import
{
SharedModule
}
from
"../../../shared/shared.module"
;
import
{
SharedModule
}
from
"../../../shared/shared.module"
;
import
{
UserProfileModel
}
from
"../../models/user.model"
;
import
{
UserProfileModel
}
from
"../../models/user.model"
;
import
{
UserService
}
from
"../../services/user.service"
;
import
{
TokenService
}
from
"../../../shared/services/token.service"
;
import
{
TokenService
}
from
"../../../shared/services/token.service"
;
import
{
FileUploadModule
}
from
'ng2-file-upload'
;
import
{
FileUploadModule
}
from
'ng2-file-upload'
;
import
{
FileItem
,
FileUploader
,
ParsedResponseHeaders
}
from
"ng2-file-upload"
;
import
{
FileItem
,
FileUploader
,
ParsedResponseHeaders
}
from
"ng2-file-upload"
;
import
{
environment
}
from
"../../../../environments/environment"
;
import
{
environment
}
from
"../../../../environments/environment"
;
import
{
AdminService
}
from
"../../services/admin.service"
;
@
Component
({
@
Component
({
selector
:
'app-admin-manage'
,
selector
:
'app-admin-manage'
,
...
@@ -22,9 +22,8 @@ import { environment } from "../../../../environments/environment";
...
@@ -22,9 +22,8 @@ import { environment } from "../../../../environments/environment";
TranslateModule
,
TranslateModule
,
NgSelectModule
,
NgSelectModule
,
FormsModule
,
FormsModule
,
MatPaginator
,
FileUploadModule
FileUploadModule
],
],
templateUrl
:
'./admin-manage.component.html'
,
templateUrl
:
'./admin-manage.component.html'
,
styleUrl
:
'./admin-manage.component.css'
styleUrl
:
'./admin-manage.component.css'
})
})
...
@@ -59,7 +58,7 @@ export class AdminManageComponent {
...
@@ -59,7 +58,7 @@ export class AdminManageComponent {
}
}
_searchTerm
=
""
;
_searchTerm
=
""
;
constructor
(
private
userService
:
User
Service
,
public
translate
:
TranslateService
,
private
tokenService
:
TokenService
)
{
constructor
(
private
adminService
:
Admin
Service
,
public
translate
:
TranslateService
,
private
tokenService
:
TokenService
)
{
this
.
uploadConfig
()
this
.
uploadConfig
()
}
}
...
@@ -116,7 +115,7 @@ export class AdminManageComponent {
...
@@ -116,7 +115,7 @@ export class AdminManageComponent {
ngOnInit
():
void
{
ngOnInit
():
void
{
this
.
user
Service
.
getLists
().
subscribe
(
result
=>
{
this
.
admin
Service
.
getLists
().
subscribe
(
result
=>
{
this
.
itemsList
=
result
.
filter
(
e
=>
e
.
role
==
99
)
this
.
itemsList
=
result
.
filter
(
e
=>
e
.
role
==
99
)
this
.
updatePagedItems
()
this
.
updatePagedItems
()
})
})
...
@@ -146,7 +145,7 @@ export class AdminManageComponent {
...
@@ -146,7 +145,7 @@ export class AdminManageComponent {
})
})
.
then
((
willDelete
:
any
)
=>
{
.
then
((
willDelete
:
any
)
=>
{
if
(
willDelete
)
{
if
(
willDelete
)
{
this
.
user
Service
.
delete
(
item
).
subscribe
(
result
=>
{
this
.
admin
Service
.
delete
(
item
).
subscribe
(
result
=>
{
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสำเร็จ"
,
"success"
);
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสำเร็จ"
,
"success"
);
this
.
ngOnInit
()
this
.
ngOnInit
()
})
})
...
@@ -180,14 +179,14 @@ export class AdminManageComponent {
...
@@ -180,14 +179,14 @@ export class AdminManageComponent {
if
(
willDelete
)
{
if
(
willDelete
)
{
this
.
selectModel
.
role
=
99
this
.
selectModel
.
role
=
99
if
(
this
.
action
==
'add'
)
{
if
(
this
.
action
==
'add'
)
{
this
.
user
Service
.
save
(
this
.
selectModel
).
subscribe
(
result
=>
{
this
.
admin
Service
.
save
(
this
.
selectModel
).
subscribe
(
result
=>
{
console
.
log
(
result
)
console
.
log
(
result
)
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสมาชิก"
,
"success"
);
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสมาชิก"
,
"success"
);
this
.
ngOnInit
()
this
.
ngOnInit
()
this
.
childModal
?.
nativeElement
.
click
()
this
.
childModal
?.
nativeElement
.
click
()
})
})
}
else
if
(
this
.
action
==
'edit'
)
{
}
else
if
(
this
.
action
==
'edit'
)
{
this
.
user
Service
.
update
(
this
.
selectModel
).
subscribe
(
result
=>
{
this
.
admin
Service
.
update
(
this
.
selectModel
).
subscribe
(
result
=>
{
console
.
log
(
result
)
console
.
log
(
result
)
swal
(
"Update Success!!"
,
"บันทึกข้อมูลสมาชิก"
,
"success"
);
swal
(
"Update Success!!"
,
"บันทึกข้อมูลสมาชิก"
,
"success"
);
this
.
ngOnInit
()
this
.
ngOnInit
()
...
@@ -248,7 +247,7 @@ export class AdminManageComponent {
...
@@ -248,7 +247,7 @@ export class AdminManageComponent {
if
(
isSelected
)
{
if
(
isSelected
)
{
const
user
=
this
.
itemsList
.
find
(
user
=>
user
.
memberId
===
memberId
);
const
user
=
this
.
itemsList
.
find
(
user
=>
user
.
memberId
===
memberId
);
if
(
user
)
{
if
(
user
)
{
this
.
user
Service
.
delete
(
user
).
subscribe
(
result
=>
{
this
.
admin
Service
.
delete
(
user
).
subscribe
(
result
=>
{
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสำเร็จ"
,
"success"
);
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสำเร็จ"
,
"success"
);
this
.
ngOnInit
();
this
.
ngOnInit
();
});
});
...
@@ -284,7 +283,7 @@ export class AdminManageComponent {
...
@@ -284,7 +283,7 @@ export class AdminManageComponent {
const
user
=
this
.
itemsList
.
find
(
user
=>
user
.
memberId
===
memberId
);
const
user
=
this
.
itemsList
.
find
(
user
=>
user
.
memberId
===
memberId
);
if
(
user
)
{
if
(
user
)
{
user
.
status
=
status
user
.
status
=
status
this
.
user
Service
.
update
(
user
).
subscribe
(
result
=>
{
this
.
admin
Service
.
update
(
user
).
subscribe
(
result
=>
{
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสำเร็จ"
,
"success"
);
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสำเร็จ"
,
"success"
);
this
.
ngOnInit
();
this
.
ngOnInit
();
});
});
...
...
src/app/DPU/common/user-management/user-setting/user-setting.component.html
View file @
9aadc9ca
...
@@ -224,7 +224,7 @@
...
@@ -224,7 +224,7 @@
</div>
</div>
</div>
</div>
<div
class=
"xl:col-span-12 col-span-12"
>
<div
class=
"xl:col-span-12 col-span-12"
*
ngIf=
"modalStatus=='edit'"
>
<label
for=
"deal-title"
class=
"form-label"
>
{{'Candidate ID' | translate}}
</label>
<label
for=
"deal-title"
class=
"form-label"
>
{{'Candidate ID' | translate}}
</label>
<input
type=
"text"
class=
"form-control"
[
ngClass
]="{
'!
bg-input-readonly
'
:
action =
==
'
edit
'
}"
<input
type=
"text"
class=
"form-control"
[
ngClass
]="{
'!
bg-input-readonly
'
:
action =
==
'
edit
'
}"
id=
"deal-title"
placeholder=
""
[(
ngModel
)]="
selectModel
.
candidateId
"
[
readonly
]="
action =
==
'
edit
'"
>
id=
"deal-title"
placeholder=
""
[(
ngModel
)]="
selectModel
.
candidateId
"
[
readonly
]="
action =
==
'
edit
'"
>
...
@@ -356,7 +356,7 @@
...
@@ -356,7 +356,7 @@
data-hs-overlay=
"#modal-detail"
>
data-hs-overlay=
"#modal-detail"
>
{{'Cancel' | translate}}
{{'Cancel' | translate}}
</button>
</button>
<button
type=
"button"
(
click
)="
save
()"
class=
"ti-btn bg-primary text-white !font-medium"
<button
type=
"button"
*
ngIf=
"modalStatus=='add'"
(
click
)="
save
()"
class=
"ti-btn bg-primary text-white !font-medium"
[
class
.
ti-btn-disabled
]="
[
class
.
ti-btn-disabled
]="
!
selectModel
.
candidateId
||
!
selectModel
.
candidateId
||
!
selectModel
.
thFirstname
||
!
selectModel
.
thFirstname
||
...
...
src/app/DPU/common/user-management/user-setting/user-setting.component.ts
View file @
9aadc9ca
...
@@ -124,9 +124,7 @@ export class UserSettingComponent {
...
@@ -124,9 +124,7 @@ export class UserSettingComponent {
this
.
userService
.
getListsProfile
().
subscribe
(
result
=>
{
this
.
userService
.
getListsProfile
().
subscribe
(
result
=>
{
this
.
itemsList
=
result
.
map
(
item
=>
new
UserProfileModel
(
item
,
this
.
translate
));
this
.
itemsList
=
result
.
map
(
item
=>
new
UserProfileModel
(
item
,
this
.
translate
));
this
.
filterList
=
[...
this
.
itemsList
];
this
.
filterList
=
[...
this
.
itemsList
];
});
this
.
existingEmails
=
result
;
this
.
userService
.
getListsProfile
().
subscribe
(
email
=>
{
this
.
existingEmails
=
email
;
});
});
}
}
...
...
src/app/DPU/models/auth.model.ts
View file @
9aadc9ca
import
{
TranslateService
}
from
"@ngx-translate/core"
import
{
TranslateService
}
from
"@ngx-translate/core"
import
{
BaseModel
}
from
"./base.model"
import
{
BaseModel
}
from
"./base.model"
import
{
RoleModel
}
from
"./role.model"
import
{
RoleModel
}
from
"./role.model"
import
{
ProfileModel
}
from
"./profile.model"
export
interface
AuthModel
{
export
interface
AuthModel
{
username
:
string
username
:
string
password
:
string
password
:
string
role
:
RoleModel
role
:
RoleModel
profile
:
ProfileModel
}
}
export
class
AuthModel
extends
BaseModel
implements
AuthModel
{
export
class
AuthModel
extends
BaseModel
implements
AuthModel
{
username
:
string
username
:
string
password
:
string
password
:
string
role
:
RoleModel
role
:
RoleModel
profile
:
ProfileModel
constructor
(
data
?:
Partial
<
AuthModel
>
,
translateService
?:
TranslateService
)
{
constructor
(
data
?:
Partial
<
AuthModel
>
,
translateService
?:
TranslateService
)
{
super
(
data
,
translateService
)
super
(
data
,
translateService
)
this
.
username
=
data
?.
username
!
this
.
username
=
data
?.
username
!
this
.
password
=
data
?.
password
!
this
.
password
=
data
?.
password
!
this
.
role
=
data
?.
role
?
new
RoleModel
(
data
.
role
,
translateService
)
:
data
?.
role
!
this
.
role
=
data
?.
role
?
new
RoleModel
(
data
.
role
,
translateService
)
:
data
?.
role
!
this
.
profile
=
data
?.
profile
?
new
ProfileModel
(
data
.
profile
,
translateService
)
:
data
?.
profile
!
}
}
}
}
...
...
src/app/DPU/models/profile.model.ts
View file @
9aadc9ca
...
@@ -28,7 +28,7 @@ import { RelationShipModel } from "./relationship.model";
...
@@ -28,7 +28,7 @@ import { RelationShipModel } from "./relationship.model";
import
{
ReligionModel
}
from
"./religion.model"
;
import
{
ReligionModel
}
from
"./religion.model"
;
import
{
SubDistrictModel
}
from
"./subdistrict.model"
;
import
{
SubDistrictModel
}
from
"./subdistrict.model"
;
import
{
JobTypeModel
}
from
"./job-type.model"
;
import
{
JobTypeModel
}
from
"./job-type.model"
;
import
{
environment
}
from
"
src
/environments/environment"
;
import
{
environment
}
from
"
../../..
/environments/environment"
;
export
interface
ProfileModel
{
export
interface
ProfileModel
{
addressCurrent
:
string
addressCurrent
:
string
...
@@ -39,6 +39,7 @@ export interface ProfileModel {
...
@@ -39,6 +39,7 @@ export interface ProfileModel {
buildingCurrent
:
string
buildingCurrent
:
string
buildingEmergency
:
string
buildingEmergency
:
string
buildingHome
:
string
buildingHome
:
string
candidateId
:
string
carEndDate
:
string
carEndDate
:
string
carLicense
:
number
carLicense
:
number
carLicenseNumber
:
string
carLicenseNumber
:
string
...
@@ -188,6 +189,7 @@ export class ProfileModel extends BaseModel implements ProfileModel {
...
@@ -188,6 +189,7 @@ export class ProfileModel extends BaseModel implements ProfileModel {
buildingCurrent
:
string
buildingCurrent
:
string
buildingEmergency
:
string
buildingEmergency
:
string
buildingHome
:
string
buildingHome
:
string
candidateId
:
string
carEndDate
:
string
carEndDate
:
string
carLicense
:
number
carLicense
:
number
carLicenseNumber
:
string
carLicenseNumber
:
string
...
@@ -310,6 +312,7 @@ export class ProfileModel extends BaseModel implements ProfileModel {
...
@@ -310,6 +312,7 @@ export class ProfileModel extends BaseModel implements ProfileModel {
this
.
buildingCurrent
=
checkData
(
data
?.
buildingCurrent
)
this
.
buildingCurrent
=
checkData
(
data
?.
buildingCurrent
)
this
.
buildingEmergency
=
checkData
(
data
?.
buildingEmergency
)
this
.
buildingEmergency
=
checkData
(
data
?.
buildingEmergency
)
this
.
buildingHome
=
checkData
(
data
?.
buildingHome
)
this
.
buildingHome
=
checkData
(
data
?.
buildingHome
)
this
.
candidateId
=
checkData
(
data
?.
candidateId
)
this
.
carEndDate
=
checkData
(
data
?.
carEndDate
)
this
.
carEndDate
=
checkData
(
data
?.
carEndDate
)
this
.
carLicense
=
checkData
(
data
?.
carLicense
)
this
.
carLicense
=
checkData
(
data
?.
carLicense
)
this
.
carLicenseNumber
=
checkData
(
data
?.
carLicenseNumber
)
this
.
carLicenseNumber
=
checkData
(
data
?.
carLicenseNumber
)
...
@@ -425,7 +428,7 @@ export class ProfileModel extends BaseModel implements ProfileModel {
...
@@ -425,7 +428,7 @@ export class ProfileModel extends BaseModel implements ProfileModel {
}
}
getPicture
()
{
getPicture
()
{
return
this
.
picture
?
(
environment
.
u
rl
+
"/files/image/"
+
this
.
picture
)
:
null
return
this
.
picture
?
(
environment
.
baseU
rl
+
"/files/image/"
+
this
.
picture
)
:
null
}
}
getName
()
{
getName
()
{
...
@@ -896,14 +899,22 @@ export class ProfileLoginModel extends BaseModel implements ProfileLoginModel {
...
@@ -896,14 +899,22 @@ export class ProfileLoginModel extends BaseModel implements ProfileLoginModel {
}
}
getAge
(){
getStatus
():
string
{
if
(
this
.
status
==
1
)
{
return
this
.
translateService
.
instant
(
'Active'
);
}
else
{
return
this
.
translateService
.
instant
(
'Unactive'
);
}
}
getAge
()
{
var
ageDifMs
=
Date
.
now
()
-
new
Date
(
this
.
birthday
).
getTime
();
var
ageDifMs
=
Date
.
now
()
-
new
Date
(
this
.
birthday
).
getTime
();
var
ageDate
=
new
Date
(
ageDifMs
);
// miliseconds from epoch
var
ageDate
=
new
Date
(
ageDifMs
);
// miliseconds from epoch
return
Math
.
abs
(
ageDate
.
getUTCFullYear
()
-
1970
);
return
Math
.
abs
(
ageDate
.
getUTCFullYear
()
-
1970
);
}
}
getPicture
()
{
getPicture
()
{
return
this
.
picture
?
(
environment
.
u
rl
+
"/files/image/"
+
this
.
picture
)
:
(
this
.
sex
==
1
?
"assets/img/icon/icon_female.png"
:
"assets/img/icon/icon_male.png"
)
return
this
.
picture
?
(
environment
.
baseU
rl
+
"/files/image/"
+
this
.
picture
)
:
(
this
.
sex
==
1
?
"assets/img/icon/icon_female.png"
:
"assets/img/icon/icon_male.png"
)
}
}
getName
()
{
getName
()
{
...
@@ -960,7 +971,7 @@ export class ProfileLoginModel extends BaseModel implements ProfileLoginModel {
...
@@ -960,7 +971,7 @@ export class ProfileLoginModel extends BaseModel implements ProfileLoginModel {
return
baseGetName
(
this
.
thFullName
,
this
.
engFullName
,
this
.
translateService
.
currentLang
)
return
baseGetName
(
this
.
thFullName
,
this
.
engFullName
,
this
.
translateService
.
currentLang
)
}
}
getNickName
(){
getNickName
()
{
return
baseGetName
(
this
.
thNickName
,
this
.
engNickName
,
this
.
translateService
.
currentLang
)
return
baseGetName
(
this
.
thNickName
,
this
.
engNickName
,
this
.
translateService
.
currentLang
)
}
}
}
}
src/app/DPU/services/admin.service.ts
0 → 100644
View file @
9aadc9ca
import
{
HttpClient
,
HttpHeaders
}
from
'@angular/common/http'
;
import
{
Injectable
}
from
'@angular/core'
;
import
{
TranslateService
}
from
'@ngx-translate/core'
;
import
{
TokenService
}
from
'../../shared/services/token.service'
;
import
{
UserProfileModel
}
from
'../models/user.model'
;
import
{
map
,
tap
,
switchMap
,
filter
,
reduce
}
from
"rxjs/operators"
;
import
{
PageResponseModel
,
ResponseModel
}
from
'../models/base.model'
;
import
{
forkJoin
,
Observable
}
from
'rxjs'
;
@
Injectable
({
providedIn
:
'root'
})
export
class
AdminService
{
apiBaseUrl
=
"/admin"
;
constructor
(
private
http
:
HttpClient
,
private
translateService
:
TranslateService
)
{
}
getById
(
id
:
Number
)
{
return
this
.
http
.
get
<
UserProfileModel
>
(
this
.
apiBaseUrl
+
"/"
+
id
)
.
pipe
(
map
((
e
)
=>
new
UserProfileModel
(
e
,
this
.
translateService
)));
}
getByUsername
(
username
:
string
)
{
return
this
.
http
.
get
<
UserProfileModel
>
(
this
.
apiBaseUrl
+
"/username/"
+
username
)
}
getLists
()
{
return
this
.
http
.
get
<
UserProfileModel
[]
>
(
this
.
apiBaseUrl
)
.
pipe
(
map
((
e
)
=>
e
.
map
((
e
)
=>
new
UserProfileModel
(
e
,
this
.
translateService
)))
);
}
getListsProfile
()
{
return
this
.
http
.
get
<
UserProfileModel
[]
>
(
this
.
apiBaseUrl
+
'/manage-profile/lists'
)
// .pipe(
// map((e) => e.map((e) => new UserProfileModel(e, this.translateService)))
// );
}
getListByPageSize
(
body
:
{
page
:
number
;
size
:
number
})
{
return
this
.
http
.
get
<
PageResponseModel
<
UserProfileModel
>>
(
this
.
apiBaseUrl
,
{
params
:
body
,
})
.
pipe
(
map
((
page
)
=>
{
return
{
...
page
,
content
:
page
.
content
.
map
(
(
e
)
=>
new
UserProfileModel
(
e
,
this
.
translateService
)
),
};
})
);
}
getListAllPageSize
():
Observable
<
UserProfileModel
[]
>
{
return
this
.
http
.
get
<
PageResponseModel
<
UserProfileModel
>>
(
this
.
apiBaseUrl
,
{
params
:
{
page
:
0
,
size
:
1
},
})
.
pipe
(
switchMap
((
checkData
:
any
)
=>
{
//console.log("checkData="+checkData)
const
size
=
500
;
const
numOfPages
=
checkData
.
totalElements
/
size
;
const
parallelList
:
Observable
<
PageResponseModel
<
UserProfileModel
>>
[]
=
[];
for
(
let
page
=
0
;
page
<
numOfPages
;
page
++
)
{
parallelList
.
push
(
this
.
getListByPageSize
({
page
,
size
,
})
);
}
return
forkJoin
(
parallelList
).
pipe
(
map
((
response
)
=>
{
let
data
:
UserProfileModel
[]
=
[];
for
(
let
i
=
0
;
i
<
response
.
length
;
i
++
)
{
data
=
data
.
concat
(
response
[
i
].
content
);
}
return
data
;
})
);
})
);
}
save
(
body
:
UserProfileModel
)
{
return
this
.
http
.
post
<
ResponseModel
>
(
this
.
apiBaseUrl
+
'/manage-profile'
,
new
UserProfileModel
(
body
));
}
update
(
body
:
UserProfileModel
)
{
return
this
.
http
.
post
<
ResponseModel
>
(
this
.
apiBaseUrl
+
"/manage-profile"
,
new
UserProfileModel
(
body
));
}
resetPass
(
email
:
string
)
{
let
tempBody
=
{
"email"
:
email
}
return
this
.
http
.
put
<
ResponseModel
>
(
this
.
apiBaseUrl
+
"/send-reset-password"
,
tempBody
);
}
resetPassUser
(
oldPassword
:
string
,
password
:
string
)
{
let
tempBody
=
{
"oldPassword"
:
oldPassword
,
"password"
:
password
}
return
this
.
http
.
put
<
ResponseModel
>
(
this
.
apiBaseUrl
+
"/reset-password"
,
tempBody
);
}
delete
(
body
:
UserProfileModel
)
{
const
options
=
{
headers
:
new
HttpHeaders
({
'Content-Type'
:
'application/json'
}),
body
:
new
UserProfileModel
(
body
)
// ส่งข้อมูลใน body
};
return
this
.
http
.
delete
<
ResponseModel
>
(
this
.
apiBaseUrl
+
"/manage-profile"
,
options
);
}
}
src/app/DPU/services/user.service.ts
View file @
9aadc9ca
...
@@ -6,12 +6,14 @@ import { UserProfileModel } from '../models/user.model';
...
@@ -6,12 +6,14 @@ import { UserProfileModel } from '../models/user.model';
import
{
map
,
tap
,
switchMap
,
filter
,
reduce
}
from
"rxjs/operators"
;
import
{
map
,
tap
,
switchMap
,
filter
,
reduce
}
from
"rxjs/operators"
;
import
{
PageResponseModel
,
ResponseModel
}
from
'../models/base.model'
;
import
{
PageResponseModel
,
ResponseModel
}
from
'../models/base.model'
;
import
{
forkJoin
,
Observable
}
from
'rxjs'
;
import
{
forkJoin
,
Observable
}
from
'rxjs'
;
import
{
AuthModel
}
from
'../models/auth.model'
;
@
Injectable
({
@
Injectable
({
providedIn
:
'root'
providedIn
:
'root'
})
})
export
class
UserService
{
export
class
UserService
{
apiBaseUrl
=
"/admin"
;
apiBaseUrl
=
"/admin"
;
apiAuthUrl
=
"/auth"
constructor
(
constructor
(
private
http
:
HttpClient
,
private
http
:
HttpClient
,
private
translateService
:
TranslateService
private
translateService
:
TranslateService
...
@@ -100,6 +102,10 @@ export class UserService {
...
@@ -100,6 +102,10 @@ export class UserService {
);
);
}
}
register
(
authModel
:
AuthModel
)
{
return
this
.
http
.
post
<
ResponseModel
>
(
this
.
apiAuthUrl
+
'/register'
,
authModel
);
}
save
(
body
:
UserProfileModel
)
{
save
(
body
:
UserProfileModel
)
{
return
this
.
http
.
post
<
ResponseModel
>
(
this
.
apiBaseUrl
+
'/manage-profile'
,
new
UserProfileModel
(
body
));
return
this
.
http
.
post
<
ResponseModel
>
(
this
.
apiBaseUrl
+
'/manage-profile'
,
new
UserProfileModel
(
body
));
}
}
...
...
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