diff --git a/dist/bundle.js b/dist/bundle.js index 9cba5cc..0cc9153 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -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); diff --git a/dist/client.js b/dist/client.js index e8256b1..e890901 100644 --- a/dist/client.js +++ b/dist/client.js @@ -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); diff --git a/src/client.ts b/src/client.ts index 23fb164..b95a8e1 100644 --- a/src/client.ts +++ b/src/client.ts @@ -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) {