aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/github.js
diff options
context:
space:
mode:
Diffstat (limited to 'application/github.js')
-rw-r--r--application/github.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/application/github.js b/application/github.js
index 42c67fb..314d263 100644
--- a/application/github.js
+++ b/application/github.js
@@ -56,11 +56,19 @@ export async function fetchRepoBranches(repository) {
return response.json()
}
-export async function fetchLayoutAndKeymap() {
- const response = await request(
- `${config.apiBaseUrl}/github/keyboard-files/${encodeURIComponent(installation.id)}/${encodeURIComponent(repositories[0].full_name)}`,
- { headers: { Authorization: `Bearer ${localStorage.auth_token}`} }
- )
+export async function fetchLayoutAndKeymap(repo, branch) {
+ const repository = repo
+ const url = new URL(`${config.apiBaseUrl}/github/keyboard-files/${encodeURIComponent(installation.id)}/${encodeURIComponent(repository)}`)
+
+ if (branch) {
+ url.search = new URLSearchParams({ branch }).toString()
+ }
+
+ const response = await request(url.toString(), {
+ headers: {
+ Authorization: `Bearer ${localStorage.auth_token}`
+ }
+ })
if (response.status === 400) {
console.error('Failed to load keymap and layout from github')