mirror of
https://github.com/plankanban/planka.git
synced 2025-12-25 17:25:01 +03:00
fix: OIDC finalization and refactoring
This commit is contained in:
@@ -4,14 +4,15 @@ import socket from './socket';
|
||||
/* Actions */
|
||||
|
||||
const createAccessToken = (data, headers) => http.post('/access-tokens', data, headers);
|
||||
const exchangeOidcToken = (accessToken, headers) =>
|
||||
http.post('/access-tokens/exchange', { token: accessToken }, headers);
|
||||
|
||||
const exchangeToAccessToken = (data, headers) =>
|
||||
http.post('/access-tokens/exchange', data, headers);
|
||||
|
||||
const deleteCurrentAccessToken = (headers) =>
|
||||
socket.delete('/access-tokens/me', undefined, headers);
|
||||
|
||||
export default {
|
||||
createAccessToken,
|
||||
exchangeToAccessToken,
|
||||
deleteCurrentAccessToken,
|
||||
exchangeOidcToken,
|
||||
};
|
||||
|
||||
@@ -5,13 +5,15 @@ import Config from '../constants/Config';
|
||||
const http = {};
|
||||
|
||||
// TODO: add all methods
|
||||
['POST'].forEach((method) => {
|
||||
['GET', 'POST'].forEach((method) => {
|
||||
http[method.toLowerCase()] = (url, data, headers) => {
|
||||
const formData = Object.keys(data).reduce((result, key) => {
|
||||
result.append(key, data[key]);
|
||||
const formData =
|
||||
data &&
|
||||
Object.keys(data).reduce((result, key) => {
|
||||
result.append(key, data[key]);
|
||||
|
||||
return result;
|
||||
}, new FormData());
|
||||
return result;
|
||||
}, new FormData());
|
||||
|
||||
return fetch(`${Config.SERVER_BASE_URL}/api${url}`, {
|
||||
method,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import http from './http';
|
||||
import socket from './socket';
|
||||
import root from './root';
|
||||
import accessTokens from './access-tokens';
|
||||
import users from './users';
|
||||
import projects from './projects';
|
||||
@@ -20,6 +21,7 @@ import notifications from './notifications';
|
||||
export { http, socket };
|
||||
|
||||
export default {
|
||||
...root,
|
||||
...accessTokens,
|
||||
...users,
|
||||
...projects,
|
||||
|
||||
9
client/src/api/root.js
Normal file
9
client/src/api/root.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import http from './http';
|
||||
|
||||
/* Actions */
|
||||
|
||||
const getConfig = (headers) => http.get('/config', undefined, headers);
|
||||
|
||||
export default {
|
||||
getConfig,
|
||||
};
|
||||
Reference in New Issue
Block a user