Skip to content
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