Skip to content

Commit a9ba78b

Browse files
committed
Fix logout button and abstudy
1 parent f439514 commit a9ba78b

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

data/part-1/4-variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ hidden: false
1616

1717
</text-box>
1818

19-
<ab-study id="ohjelmointi-20-scale-vs-mcq">
19+
<ab-study id="1a2faee2-7287-4277-ac4a-329220042a27">
2020

2121
<only-for-ab-group group="1">
2222

src/components/LoginControls.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { Fragment } from "react"
22
import Button from "./Button"
3+
import { Button as MaterialButton } from "@material-ui/core"
34
import { signOut, getCachedUserDetails } from "../services/moocfi"
45
import LoginStateContext, {
56
withLoginStateContext,
@@ -14,6 +15,11 @@ const StyledIcon = styled(FontAwesomeIcon)`
1415
margin-right: 0.5rem;
1516
`
1617

18+
const StyledButton = styled(MaterialButton)`
19+
margin: 1rem 0.5rem !important;
20+
padding: 1.1rem 1rem !important;
21+
`
22+
1723
class LoginControls extends React.Component {
1824
static contextType = LoginStateContext
1925

@@ -48,7 +54,9 @@ class LoginControls extends React.Component {
4854
<StyledIcon icon={profileIcon} />
4955
{this.state.name}
5056
</Button>
51-
<Button onClick={this.doSignOut}>{this.props.t("logout")}</Button>
57+
<StyledButton variant="outlined" onClick={this.doSignOut}>
58+
{this.props.t("logout")}
59+
</StyledButton>
5260
</Fragment>
5361
) : (
5462
<Fragment>

src/services/abstudio.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import axios from "axios"
22
import { accessToken } from "./moocfi"
33

4-
const BASE_URL = "https://ab-studio.testmycode.io"
4+
const BASE_URL = "https://www.mooc.fi"
55

66
export async function fetchAbGroup(studyId) {
7-
const res = await axios.get(
8-
`${BASE_URL}/api/v0/ab_studies/${studyId}/group?oauth_token=${accessToken()}`,
9-
)
7+
const res = await axios.get(`${BASE_URL}/api/ab-enrollments/${studyId}`, {
8+
headers: {
9+
"Content-Type": "application/json",
10+
Authorization: `Bearer ${accessToken()}`,
11+
},
12+
})
1013
return res.data
1114
}

0 commit comments

Comments
 (0)