trying to get nextjs to work
This commit is contained in:
@@ -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);
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user