-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from JoelBerglund05/Supabase-API
Supabase api
- Loading branch information
Showing
15 changed files
with
234 additions
and
29 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"liveServer.settings.port": 5501 | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
# pwa-quizz-game | ||
# pwa-quizz-game |
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 |
---|---|---|
@@ -1,3 +1 @@ | ||
class AnswerBuron{ | ||
|
||
} | ||
class AnswerBuron {} |
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 |
---|---|---|
@@ -1,3 +1 @@ | ||
class Authentication{ | ||
|
||
} | ||
class Authentication {} |
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,27 @@ | ||
import { createClient } from 'https://esm.sh/@supabase/supabase-js@2' | ||
|
||
class DataBase { | ||
constructor() { | ||
this.supabase = createClient( | ||
"https://unswumzybkmeifdigbfn.supabase.co", | ||
"KEY", | ||
); | ||
|
||
} | ||
async GetARowFrow(table, idToRow) { | ||
try { | ||
const { data, error } = await this.supabase | ||
.from(table) | ||
.select() | ||
.eq('id', idToRow); | ||
console.log(table, data); | ||
return data; | ||
} | ||
catch (e) { | ||
console.log("An Error has occured: " + event); | ||
} | ||
|
||
} | ||
} | ||
|
||
export default DataBase; |
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 |
---|---|---|
@@ -1 +1 @@ | ||
class NavigationBar{} | ||
class NavigationBar {} |
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 |
---|---|---|
@@ -1,3 +1 @@ | ||
class ProfileSettings{ | ||
|
||
} | ||
class ProfileSettings {} |
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 |
---|---|---|
@@ -1,3 +1 @@ | ||
class Question{ | ||
|
||
} | ||
class Question {} |
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 |
---|---|---|
@@ -1,4 +1 @@ | ||
class ServiceWorker{ | ||
|
||
} | ||
|
||
class ServiceWorker {} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
class Settings{} | ||
class Settings {} |
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 |
---|---|---|
@@ -1,12 +1,35 @@ | ||
class Main{ | ||
RegisterServiceWorker() { | ||
if('serviceWorker' in navigator) { | ||
navigator.serviceWorker.register('./js/ServiceWorker.js').then((reg) => { | ||
console.log('Registration succeeded. Scope is ' + reg.scope); | ||
}); | ||
} | ||
import DataBase from "./DataBase.js"; | ||
|
||
class Main { | ||
constructor() { | ||
this.dataBase = new DataBase(); | ||
this.btnDBRequest = document.getElementById("btnDBRequest"); | ||
this.displayData = document.getElementById("dBData"); | ||
} | ||
RegisterServiceWorker() { | ||
if ("serviceWorker" in navigator) { | ||
navigator.serviceWorker.register("./js/ServiceWorker.js").then((reg) => { | ||
console.log("Registration succeeded. Scope is " + reg.scope); | ||
}); | ||
} | ||
} | ||
Main() { | ||
this.RegisterServiceWorker(); | ||
|
||
this.btnDBRequest.addEventListener("click", async () => { | ||
const DBData = await this.dataBase.GetARowFrow('quizz', 1); | ||
|
||
DBData.map(data => { | ||
this.displayData.innerHTML = data.questions; | ||
}); | ||
}); | ||
|
||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
const main = new Main(); | ||
main.RegisterServiceWorker(); | ||
main.Main(); |
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 |
---|---|---|
@@ -1 +1,25 @@ | ||
{"theme_color":"#26a269","background_color":"#8ff0a4","icons":[{"purpose":"maskable","sizes":"512x512","src":"icon512_maskable.png","type":"image/png"},{"purpose":"any","sizes":"512x512","src":"icon512_rounded.png","type":"image/png"}],"orientation":"any","display":"standalone","dir":"auto","lang":"en-US","name":"Quizz Game","short_name":"QG","start_url":"https://joelberglund05.github.io/pwa-quizz-game/"} | ||
{ | ||
"theme_color": "#26a269", | ||
"background_color": "#8ff0a4", | ||
"icons": [ | ||
{ | ||
"purpose": "maskable", | ||
"sizes": "512x512", | ||
"src": "icon512_maskable.png", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"purpose": "any", | ||
"sizes": "512x512", | ||
"src": "icon512_rounded.png", | ||
"type": "image/png" | ||
} | ||
], | ||
"orientation": "any", | ||
"display": "standalone", | ||
"dir": "auto", | ||
"lang": "en-US", | ||
"name": "Quizz Game", | ||
"short_name": "QG", | ||
"start_url": "https://joelberglund05.github.io/pwa-quizz-game/" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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