mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 16:51:37 +00:00
Add fetch post list
* add gray-matter
This commit is contained in:
4
lib/utils/constant.ts
Normal file
4
lib/utils/constant.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export const server =
|
||||
process.env.NODE_ENV === 'development'
|
||||
? 'http://localhost:3000'
|
||||
: 'https://rua.plus';
|
12
lib/utils/index.ts
Normal file
12
lib/utils/index.ts
Normal file
@ -0,0 +1,12 @@
|
||||
export const sortByDate = (
|
||||
{ date: a }: { date: string },
|
||||
{ date: b }: { date: string }
|
||||
) => {
|
||||
if (a < b) {
|
||||
return 1;
|
||||
} else if (a > b) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user