mirror of
https://github.com/idolpx/csdb-ng.git
synced 2025-12-05 20:28:49 -05:00
Add files via upload
Sample client
This commit is contained in:
parent
453e53bfef
commit
f31dbc445a
16
client/index.html
Normal file
16
client/index.html
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>CSDb Example GraphQL Client</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Loading...</h1>
|
||||||
|
|
||||||
|
<img src="" />
|
||||||
|
|
||||||
|
<script src="src/js/app.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
0
client/src/css/styles.css
Normal file
0
client/src/css/styles.css
Normal file
129
client/src/js/app.js
Normal file
129
client/src/js/app.js
Normal file
|
|
@ -0,0 +1,129 @@
|
||||||
|
const GRAPHQL_URL = 'http://localhost:3000/';
|
||||||
|
|
||||||
|
async function getRelease(id) {
|
||||||
|
const response = await fetch(GRAPHQL_URL, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
query: `
|
||||||
|
query {
|
||||||
|
getRelease(id: ${id}) {
|
||||||
|
ID
|
||||||
|
Name
|
||||||
|
AKA
|
||||||
|
Type
|
||||||
|
GfxType
|
||||||
|
Rating
|
||||||
|
ReleaseDate {
|
||||||
|
Operator
|
||||||
|
Day
|
||||||
|
Month
|
||||||
|
Year
|
||||||
|
Comment
|
||||||
|
}
|
||||||
|
ReleasedAt
|
||||||
|
Achievement {
|
||||||
|
Compo
|
||||||
|
Place
|
||||||
|
}
|
||||||
|
ReleasedBy {
|
||||||
|
GroupIDs
|
||||||
|
HandleIDs
|
||||||
|
}
|
||||||
|
Credits {
|
||||||
|
CreditType
|
||||||
|
HandleID
|
||||||
|
}
|
||||||
|
Website
|
||||||
|
ScreenShot
|
||||||
|
DownloadLinks {
|
||||||
|
CounterLink
|
||||||
|
Downloads
|
||||||
|
Filename
|
||||||
|
Link
|
||||||
|
Status
|
||||||
|
crc32
|
||||||
|
}
|
||||||
|
OtherLinks {
|
||||||
|
Title
|
||||||
|
Link
|
||||||
|
CounterLink
|
||||||
|
Clicks
|
||||||
|
}
|
||||||
|
Comments {
|
||||||
|
Summary {
|
||||||
|
Date
|
||||||
|
ScenerID
|
||||||
|
Text
|
||||||
|
}
|
||||||
|
Trivia {
|
||||||
|
Date
|
||||||
|
ScenerID
|
||||||
|
Text
|
||||||
|
}
|
||||||
|
Goofs {
|
||||||
|
Date
|
||||||
|
ScenerID
|
||||||
|
Text
|
||||||
|
}
|
||||||
|
HiddenPart {
|
||||||
|
Date
|
||||||
|
ScenerID
|
||||||
|
Text
|
||||||
|
}
|
||||||
|
ProductionNote {
|
||||||
|
Date
|
||||||
|
ScenerID
|
||||||
|
Text
|
||||||
|
}
|
||||||
|
UserComment {
|
||||||
|
Date
|
||||||
|
ScenerID
|
||||||
|
Text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SIDIDs
|
||||||
|
Groups {
|
||||||
|
ID
|
||||||
|
Name
|
||||||
|
}
|
||||||
|
Sceners {
|
||||||
|
ID
|
||||||
|
Country
|
||||||
|
}
|
||||||
|
Handles {
|
||||||
|
ID
|
||||||
|
Handle
|
||||||
|
}
|
||||||
|
Events {
|
||||||
|
ID
|
||||||
|
Name
|
||||||
|
Tagline
|
||||||
|
}
|
||||||
|
SIDs {
|
||||||
|
ID
|
||||||
|
Name
|
||||||
|
HVSCPath
|
||||||
|
}
|
||||||
|
Tags
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
const {
|
||||||
|
data
|
||||||
|
} = await response.json();
|
||||||
|
return data.getRelease;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getRelease(1).then((release) => {
|
||||||
|
const title = document.querySelector('h1');
|
||||||
|
title.textContent = release.Name;
|
||||||
|
const screenshot = document.querySelector('img');
|
||||||
|
screenshot.src = release.ScreenShot;
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user