mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 23:57:55 -05:00
make api request with auth
This commit is contained in:
parent
d1fdf9556d
commit
a55442d07f
1 changed files with 4 additions and 3 deletions
|
@ -2,7 +2,7 @@ import keyMirror from 'keymirror';
|
|||
|
||||
import api from '../../../lib/api';
|
||||
import {curators, managers} from './redux-modules';
|
||||
import {selectUsername} from '../../../redux/session';
|
||||
import {selectUsername, selectToken} from '../../../redux/session';
|
||||
import {selectStudioId, setRoles, setInfo} from '../../../redux/studio';
|
||||
import {withAdmin} from '../../../lib/admin-requests';
|
||||
|
||||
|
@ -190,13 +190,14 @@ const acceptInvitation = () => ((dispatch, getState) => new Promise((resolve, re
|
|||
const transferOwnership = (newOwnerName, newOwnerId) => ((dispatch, getState) => new Promise((resolve, reject) => {
|
||||
const state = getState();
|
||||
const studioId = selectStudioId(state);
|
||||
const token = selectToken(state);
|
||||
newOwnerName = newOwnerName.trim();
|
||||
api({
|
||||
uri: `/studios/${studioId}/transfer-ownership/${newOwnerName}`,
|
||||
method: 'PUT',
|
||||
authentication: token,
|
||||
withCredentials: true,
|
||||
useCsrf: true,
|
||||
host: '' // Not handled by the API, use existing infrastructure
|
||||
useCsrf: true
|
||||
}, (err, body, res) => {
|
||||
const error = normalizeError(err, body, res);
|
||||
if (error) return reject(error);
|
||||
|
|
Loading…
Reference in a new issue