Skip to content
Merged
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
12 changes: 12 additions & 0 deletions dist/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,18 @@
const response = await this.fetch(`/groups/id/${encodeURIComponent(group_id)}/assignments/id/${encodeURIComponent(assignment_id)}/submissions/id/${encodeURIComponent(id)}/xml/`);
return await response.text();
}
async redeemJoinCode(code) {
const body = { code };
const response = await this.post(`/users/${this.username}/memberships/`, body);
const user = await response.json();
this.groupId = user.groupId;
return user;
}
async leaveGroup() {
const response = await this.delete(`/users/${this.username}/memberships/`);
this.groupId = null;
return await response.json();
}
// Cloud: user messages (to be overridden)
message(string) {
alert(string);
Expand Down
12 changes: 12 additions & 0 deletions dist/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,18 @@
const response = await this.fetch(`/groups/id/${encodeURIComponent(group_id)}/assignments/id/${encodeURIComponent(assignment_id)}/submissions/id/${encodeURIComponent(id)}/xml/`);
return await response.text();
}
async redeemJoinCode(code) {
const body = { code };
const response = await this.post(`/users/${this.username}/memberships/`, body);
const user = await response.json();
this.groupId = user.groupId;
return user;
}
async leaveGroup() {
const response = await this.delete(`/users/${this.username}/memberships/`);
this.groupId = null;
return await response.json();
}
// Cloud: user messages (to be overridden)
message(string) {
alert(string);
Expand Down
14 changes: 14 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,20 @@ export default class Cloud {
return await response.text();
}

async redeemJoinCode(code: string) {
const body = { code };
const response = await this.post(`/users/${this.username}/memberships/`, body);
const user = await response.json();
this.groupId = user.groupId;
return user;
}

async leaveGroup() {
const response = await this.delete(`/users/${this.username}/memberships/`);
this.groupId = null;
return await response.json();
}

// Cloud: user messages (to be overridden)

message(string) {
Expand Down