mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-17 18:36:21 +00:00
fix(frontend/blog/post) fix compatibility with new backend
- switch to axios
This commit is contained in:
4 files changed
+24
-11
No files matched your search
@@ -1,9 +1,11 @@
|
||||
import axios from 'axios';
|
||||
|
||||
export default async function fetch_posts_list(): Promise<any> {
|
||||
const response = await fetch(`http://localhost:${ process.env.BACKEND_PORT }/api/get/post_list`);
|
||||
if (!response.ok) {
|
||||
const response = await axios(`http://localhost:${ process.env.BACKEND_PORT }/api/get/post_list`);
|
||||
if (response.status !== 200) {
|
||||
throw new Error(response.statusText);
|
||||
}
|
||||
return await response.json();
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user