16 lines
No EOL
341 B
JavaScript
16 lines
No EOL
341 B
JavaScript
export async function load_post() {
|
|
try {
|
|
const response = await fetch('http://127.0.0.1:8000');
|
|
|
|
if (!response.ok) {
|
|
return {status: -1};
|
|
}
|
|
|
|
const data = response.status == 200 ? await response.json() : [];
|
|
return {
|
|
data: data, status: response.status
|
|
}
|
|
} catch (err) {
|
|
return {status: -1};
|
|
}
|
|
} |