Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function SpannerBlog({ staticPosts }: any) {
<p className="text-sm mt-2">
<i>
Created at {new Date(post.created_at).toLocaleString()} by{" "}
{post.author.first_name} {post.author.last_name}
{post.author}
</i>
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/spanner/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function wrapWithBase<R>(
}

export const spannerApiFetch = wrapWithBase<Promise<any>>(
"https://spanner.wwlrc.co.uk",
"https://spanner.wwlrc.co.uk/api/public/v1",
async (path) => {
let response = await fetch(path);
// TODO: probably worth putting some more fancy error handling here
Expand Down
11 changes: 4 additions & 7 deletions src/spanner/blog.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { spannerApiFetch, spannerPathCat } from "./api";
import { spannerApiFetch } from "./api";
import { wwlrcClubId } from "./wwlrc";

export async function getPosts(): Promise<any[]> {
let data = await spannerApiFetch("api/clubs/c/:clubId/blog_posts", {
clubId: wwlrcClubId,
size: 10,
page: 0,
"sorts[created_at]": "desc",
let data = await spannerApiFetch("news", {
clubs: wwlrcClubId,
});

return data.rows == null ? [] : data.rows;
return data.posts == null ? [] : data.posts;
}
4 changes: 2 additions & 2 deletions src/spanner/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { spannerApiFetch } from "./api";
import { wwlrcClubId } from "./wwlrc";

export async function getEvents() {
let data = await spannerApiFetch("api/clubs/c/:clubId/rallies", {
let data = await spannerApiFetch("/rallies", {
clubId: wwlrcClubId,
size: 25,
page: 0,
"sorts[start_date]": "desc",
});

let events = data.rows == null ? [] : data.rows;
let events = data.rallies == null ? [] : data.rallies;
events.sort(function (a: any, b: any): number {
let aStartDate = new Date(a.start_date);
let bStartDate = new Date(b.start_date);
Expand Down