Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Meu-Template-Angular-CSR
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Trần Anh Phú
Meu-Template-Angular-CSR
Commits
6b447bc1
Commit
6b447bc1
authored
Nov 14, 2024
by
vtduong0912
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: optimized
parent
41d4ff00
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
12 deletions
+11
-12
job-manager.service.ts
...management/job/data-access/service/job-manager.service.ts
+3
-3
job-form.component.ts
src/app/+admin/management/job/feature/job-form.component.ts
+1
-5
job-list.component.ts
src/app/+admin/management/job/feature/job-list.component.ts
+1
-2
auth.guard.ts
src/app/+login/data-access/guard/auth.guard.ts
+1
-1
login.guard.ts
src/app/+login/data-access/guard/login.guard.ts
+5
-1
No files found.
src/app/+admin/management/job/data-access/service/job-manager.service.ts
View file @
6b447bc1
...
...
@@ -19,7 +19,7 @@ export class JobManagerService {
}
jobsGetOne
(
id
:
string
)
{
return
this
.
_http
.
get
<
ResponseResult
<
JobApi
.
Response
>>
(
'jobs/'
+
id
);
return
this
.
_http
.
get
<
ResponseResult
<
JobApi
.
Response
>>
(
`jobs/
${
id
}
`
);
}
jobsPost
(
request
:
JobApi
.
Request
)
{
...
...
@@ -27,10 +27,10 @@ export class JobManagerService {
}
jobsPut
(
id
:
string
,
request
:
JobApi
.
Request
)
{
return
this
.
_http
.
put
<
ResponseResult
<
JobApi
.
Request
>>
(
'jobs/'
+
id
,
request
);
return
this
.
_http
.
put
<
ResponseResult
<
JobApi
.
Request
>>
(
`jobs/
${
id
}
`
,
request
);
}
jobsDelete
(
id
:
string
)
{
return
this
.
_http
.
delete
<
ResponseResult
<
JobApi
.
Request
>>
(
'jobs/'
+
id
);
return
this
.
_http
.
delete
<
ResponseResult
<
JobApi
.
Request
>>
(
`jobs/
${
id
}
`
);
}
}
\ No newline at end of file
src/app/+admin/management/job/feature/job-form.component.ts
View file @
6b447bc1
...
...
@@ -51,7 +51,7 @@ import { catchError, of, tap } from 'rxjs';
`
})
export
class
JobFormComponent
implements
OnInit
,
OnDestroy
{
export
class
JobFormComponent
implements
OnInit
{
isCreate
:
boolean
=
false
;
...
...
@@ -75,10 +75,6 @@ export class JobFormComponent implements OnInit, OnDestroy {
}
ngOnDestroy
()
{
}
onCreateSubmit
()
{
const
data
=
this
.
jobCreatingFormGroup
.
value
;
if
(
!
this
.
jobCreatingFormGroup
.
valid
)
{
...
...
src/app/+admin/management/job/feature/job-list.component.ts
View file @
6b447bc1
...
...
@@ -228,7 +228,6 @@ export class JobListComponent implements OnInit {
tap
((
response
:
ResponseResult
<
JobApi
.
Request
>
)
=>
{
this
.
getAllJobs
();
this
.
isEdit
=
false
;
console
.
log
(
response
);
}),
catchError
((
err
)
=>
{
console
.
log
(
err
);
...
...
@@ -245,7 +244,7 @@ export class JobListComponent implements OnInit {
.
pipe
(
tap
((
response
:
ResponseResult
<
JobApi
.
Response
>
)
=>
{
this
.
jobEdittingFormGroup
=
this
.
_fb
.
group
({
type
:
[
response
.
responseData
?.
type
,
Validators
.
required
],
type
:
[
''
,
Validators
.
required
],
company
:
[
response
.
responseData
?.
company
,
Validators
.
required
],
company_url
:
[
response
.
responseData
?.
company_url
,
Validators
.
required
],
location
:
[
response
.
responseData
?.
location
,
Validators
.
required
],
...
...
src/app/+login/data-access/guard/auth.guard.ts
View file @
6b447bc1
...
...
@@ -11,7 +11,7 @@ export class AuthGuard implements CanActivate {
const
isLoggedIn
=
this
.
_service
.
isLoggedIn
();
const
isAdmin
=
this
.
_service
.
isAdmin
();
if
(
!
isLoggedIn
||
!
isAdmin
)
{
this
.
_router
.
navigate
([
'/'
]);
this
.
_router
.
navigate
([
'/
home
'
]);
return
false
;
}
return
true
;
...
...
src/app/+login/data-access/guard/login.guard.ts
View file @
6b447bc1
...
...
@@ -8,6 +8,10 @@ import { AuthService } from '../service/auth.service';
export
class
LoginGuard
implements
CanActivate
{
constructor
(
private
_service
:
AuthService
,
private
_router
:
Router
)
{}
canActivate
():
boolean
{
return
!
this
.
_service
.
isLoggedIn
();
if
(
this
.
_service
.
isLoggedIn
())
{
this
.
_router
.
navigate
([
'/home'
]);
return
false
;
}
return
true
;
}
}
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