Skip to content

Commit

Permalink
#41.11 | ...
Browse files Browse the repository at this point in the history
  • Loading branch information
LuongXuanNhat committed Dec 6, 2023
1 parent 455d2ee commit c095d16
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"options": {
"baseHref": "/VietNamHistory_FEweb/",
"allowedCommonJsDependencies": ["@ckeditor/ckeditor5-build-classic"],
"outputPath": "dist/viet-nam-history",
"outputPath": "docs",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": [
Expand Down
5 changes: 4 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@
</style>
<body class="ig-typography ig-scrollbar">
<app-root></app-root>
<script src="runtime.10f09cdf8c3e24d5.js" type="module"></script><script src="polyfills.918ca83f6100aaee.js" type="module"></script><script src="scripts.cd816875f3dc91fb.js" defer></script><script src="main.38ee196bdf96d297.js" type="module"></script></body>
<script src="runtime.10f09cdf8c3e24d5.js" type="module"></script>
<script src="polyfills.918ca83f6100aaee.js" type="module"></script>
<script src="scripts.cd816875f3dc91fb.js" defer></script>
<script src="main.38ee196bdf96d297.js" type="module"></script></body>
</html>
2 changes: 1 addition & 1 deletion src/app/ObjectClass/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export interface News {
id: string;
title: string;
description: string;
createdAt: Date;
createdAt: Date | string;
image: string;
url: string;
}
2 changes: 1 addition & 1 deletion src/app/news/news.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ <h5 class="mt mb" style="text-align: center;">
📻 Bản tin lịch sử tổng hợp
</h5>
<div class="mt-1">
<a *ngFor="let new of news" href="{{new.url}}" class="flex-center-h mt text-black underline-none">
<a *ngFor="let new of news" [href]="new.url" class="flex-center-h mt text-black underline-none" target="_blank">
<img class="img-news" src="{{new.image}}" loading="lazy" alt="ảnh tin tức">
<div class="ml-1 dis-block">
<div>
Expand Down
13 changes: 12 additions & 1 deletion src/app/news/news.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component } from '@angular/core';
import { PublicserviceService } from '../service/publicservice.service';
import { News } from '../ObjectClass/object';
import { ToastrService } from 'ngx-toastr';
import { format, parseISO } from 'date-fns';

@Component({
selector: 'app-news',
Expand All @@ -18,7 +19,8 @@ export class NewsComponent {
this.service.GetNews().subscribe(
(data: any) => {
if(data.isSuccessed){
this.news = data.resultObj;
this.news = data.resultObj;
this.ConvertDate();
} else {
this.toastr.error("Lỗi: " + data.message);
}
Expand All @@ -27,4 +29,13 @@ export class NewsComponent {
}
)
}
ConvertDate(){
this.news.forEach(element => {
const parsedDate = parseISO(element.createdAt?.toString() ?? "");

if (!isNaN(parsedDate.getTime())) {
element.createdAt = format(parsedDate, 'dd-MM-yyyy hh:mm');
}
});
}
}
4 changes: 2 additions & 2 deletions src/app/service/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { Injectable } from '@angular/core';
export class AuthService {

constructor(private http: HttpClient ) { }
apiurl = 'https://vuanhpham25-001-site1.gtempurl.com';
// apiurl = 'https://localhost:7138';
// apiurl = 'https://vuanhpham25-001-site1.gtempurl.com';
apiurl = 'https://localhost:7138';
getApiUrl(){
return this.apiurl;
}
Expand Down

0 comments on commit c095d16

Please sign in to comment.