Fix API URLs
This commit is contained in:
parent
a562b6e140
commit
dabcd7b75a
4 changed files with 21 additions and 5 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -340,5 +340,6 @@ $RECYCLE.BIN/
|
||||||
|
|
||||||
schedule
|
schedule
|
||||||
|
|
||||||
|
public/
|
||||||
dist/
|
dist/
|
||||||
data.db
|
schedule.db
|
|
@ -23,7 +23,7 @@ export async function getSchedule(): Promise<Schedule> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createScheduleItem(data: { name: string, duration: string, date: string }) {
|
export async function createScheduleItem(data: { name: string, duration: string, date: string }) {
|
||||||
const res = await fetch(API_URL, {
|
const res = await fetch(`${API_URL}/items`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
|
@ -42,7 +42,7 @@ export async function createScheduleItem(data: { name: string, duration: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteScheduleItem(id: number) {
|
export async function deleteScheduleItem(id: number) {
|
||||||
const res = await fetch(`${API_URL}/${id}`, {
|
const res = await fetch(`${API_URL}/items/${id}`, {
|
||||||
method: "DELETE"
|
method: "DELETE"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
2
main.go
2
main.go
|
@ -71,7 +71,7 @@ func dateRange(from time.Time, to time.Time) []time.Time {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
db, err := gorm.Open(sqlite.Open("data.db"), &gorm.Config{})
|
db, err := gorm.Open(sqlite.Open("schedule.db"), &gorm.Config{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to open database: %v", err)
|
log.Fatalf("failed to open database: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,16 @@
|
||||||
Hello World!
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" href="/favicon.ico" sizes="any">
|
||||||
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Schedule</title>
|
||||||
|
<script type="module" crossorigin src="/assets/index-b0266e6c.js"></script>
|
||||||
|
<link rel="stylesheet" href="/assets/index-7823ff9f.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue