forked from kolplattformen/skolplattformen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ๐ธ Loads schedule (kolplattformen#16)
* feat: ๐ธ Loads schedule โ Closes: kolplattformen#13 * feat: ๐ธ Made running code from node easier * feat: ๐ธ News โ Closes: kolplattformen#8 * Accurate method calls and some parsing * fix: ๐ธ Calendar and classmates are now called and parsed correctly
- Loading branch information
1 parent
5996f1d
commit 53d42de
Showing
12 changed files
with
644 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,5 +102,3 @@ dist | |
|
||
# TernJS port file | ||
.tern-port | ||
|
||
run.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module 'h2m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { etjanst, newsItem } from './parse' | ||
import routes from './routes' | ||
import { Fetch, NewsItem, RequestInit } from './types' | ||
|
||
export class News { | ||
public items: NewsItem[] | ||
|
||
constructor(items: NewsItem[]) { | ||
this.items = items | ||
} | ||
} | ||
|
||
export const news = (fetch: Fetch, init?: RequestInit) => async (childId: string): Promise<News> => { | ||
const url = routes.news(childId) | ||
const response = await fetch(url, init) | ||
const data = await response.json() | ||
return new News(etjanst(data).newsItems.map(newsItem)) | ||
} |
Oops, something went wrong.