Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better webmod gui #148

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
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
18 changes: 18 additions & 0 deletions src/resources/projectapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,24 @@ class ProjectApi {
static OriginApiUrl = OriginApiUrl;
static CachedDonators = {};

static canUploadProjects() {
return fetch(`${OriginApiUrl}/api/v1/projects/canuploadprojects`)
.then(async res => {
// if this api call fails, expect that all others will fail aswell
if (!res.ok) return false;
return (await res.json()).canUpload;
})
.catch(() => false);
}
static canViewProjects() {
return fetch(`${OriginApiUrl}/api/v1/projects/canviewprojects`)
.then(async res => {
// if this api call fails, expect that all others will fail aswell
if (!res.ok) return false;
return (await res.json()).viewing;
})
.catch(() => false);
}
static getServerInfo(user) {
return new Promise((resolve, reject) => {
const url = `${OriginApiUrl}/api/v1/misc/getStats`;
Expand Down
Loading