trying to get nextjs to work

This commit is contained in:
2022-11-06 22:52:29 +01:00
parent 78b57dc4ad
commit 3ac968a63c
10 changed files with 103 additions and 40 deletions

View File

@@ -12,6 +12,25 @@ export type Post = {
};
export const getPosts = cache(async (): Promise<Post[]> => {
const updatePosts = async () => {
return new Promise((resolve, reject) => {
exec(
`(cd ${process.env.POSTS_DIR}; git pull --rebase)`,
(error, stdout, stderr) => {
if (error) {
console.warn(error);
reject(
'could not update posts stderr: ' + stderr + 'stdout: ' + stdout,
);
return;
}
resolve(true);
},
);
});
};
await updatePosts();
return new Promise((resolve, reject) => {
@@ -28,22 +47,3 @@ export const getPosts = cache(async (): Promise<Post[]> => {
});
});
});
const updatePosts = async () => {
return new Promise((resolve, reject) => {
exec(
`(cd ${process.env.POSTS_DIR}; git pull --rebase)`,
(error, stdout, stderr) => {
if (error) {
console.warn(error);
reject(
'could not update posts stderr: ' + stderr + 'stdout: ' + stdout,
);
return;
}
resolve(true);
},
);
});
};