Skip to content

Commit 47ff9fe

Browse files
authored
Merge pull request #1194 from mathematicalthinking/adminActionButtons
Log user out when admin status changes
2 parents 94fe80f + dcdff28 commit 47ff9fe

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "client",
3-
"version": "3.3.5",
3+
"version": "3.3.6",
44
"private": true,
55
"dependencies": {
66
"@xstate/react": "^3.0.1",

client/src/Containers/Dashboard.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,16 @@ class Dashboard extends Component {
239239
});
240240

241241
removeAsAdmin = (userId) =>
242-
this._buttonAction(() => API.removeAsAdmin(userId), userId, {
243-
isAdmin: false,
244-
});
242+
this.logoutUser(userId).then(() =>
243+
this._buttonAction(() => API.removeAsAdmin(userId), userId, {
244+
isAdmin: false,
245+
})
246+
);
245247

246248
makeAdmin = (userId) =>
247-
this._buttonAction(() => API.makeAdmin(userId), userId, { isAdmin: true });
249+
this.logoutUser(userId).then(() =>
250+
this._buttonAction(() => API.makeAdmin(userId), userId, { isAdmin: true })
251+
);
248252

249253
updateVisibleResource = (itemId, update) => {
250254
const { visibleResources } = this.state;

client/src/Routes/MyVmt.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,60 +32,60 @@ const pages = [
3232
{
3333
path: '/courses/:course_id/:resource',
3434
component: Course,
35-
redirectPath: '/classcode',
35+
redirectPath: '/',
3636
},
3737
{
3838
path: '/courses/:course_id/activities/:activity_id/:resource',
3939
// component: Activity,
4040
component: withPopulatedActivity(Activity),
41-
redirectPath: '/classcode',
41+
redirectPath: '/',
4242
},
4343
{
4444
path:
4545
'/courses/:course_id/activities/:activity_id/rooms/:room_id/:resource',
4646
component: Room,
47-
redirectPath: '/classcode',
47+
redirectPath: '/',
4848
},
4949
{
5050
path: '/activities/:activity_id/rooms/:room_id/:resource',
5151
component: Room,
52-
redirectPath: '/signup',
52+
redirectPath: '/',
5353
},
5454
{
5555
path: '/courses/:course_id/rooms/:room_id/:resource',
5656
component: Room,
57-
redirectPath: '/classcode',
57+
redirectPath: '/',
5858
},
5959
{
6060
path: '/courses/:course_id/rooms/:room_id/:resource',
6161
component: Room,
62-
redirectPath: '/classcode',
62+
redirectPath: '/',
6363
},
6464
{
6565
path: '/rooms/:room_id/:resource',
6666
component: Room,
67-
redirectPath: '/signup',
67+
redirectPath: '/',
6868
},
6969
{
7070
path: '/activities/:activity_id/:resource',
7171
// component: Activity,
7272
component: withPopulatedActivity(Activity),
73-
redirectPath: '/signup',
73+
redirectPath: '/',
7474
},
7575
{
7676
path: '/workspace/:room_id/replayer',
7777
component: withPopulatedRoom(SharedReplayer),
78-
redirectPath: '/signup',
78+
redirectPath: '/',
7979
},
8080
{
8181
path: '/workspace/:activity_id/activity',
8282
component: ActivityWorkspace,
83-
redirectPath: '/signup',
83+
redirectPath: '/',
8484
},
8585
{
8686
path: '/workspace/:room_id',
8787
component: withPopulatedRoom(withControlMachine(Workspace)),
88-
redirectPath: '/signup',
88+
redirectPath: '/',
8989
},
9090
{
9191
path: '/confirmation',

0 commit comments

Comments
 (0)