feat(api): deprecate get account endpoint (#50419)

This commit is contained in:
Muhammed Mustafa
2023-06-02 09:09:54 +03:00
committed by GitHub
parent 458084de84
commit e368410c89
2 changed files with 4 additions and 7 deletions
+2 -6
View File
@@ -21,6 +21,7 @@ import {
createDeleteUserToken,
encodeUserToken
} from '../middlewares/user-token';
import { deprecatedEndpoint } from '../utils/disabled-endpoints';
const log = debugFactory('fcc:boot:user');
const sendNonUserToHome = ifNoUserRedirectHome();
@@ -34,7 +35,7 @@ function bootUser(app) {
const postUserToken = createPostUserToken(app);
const deleteUserToken = createDeleteUserToken(app);
api.get('/account', sendNonUserToHome, getAccount);
api.get('/account', sendNonUserToHome, deprecatedEndpoint);
api.get('/account/unlink/:social', sendNonUserToHome, getUnlinkSocial);
api.get('/user/get-session-user', getSessionUser);
api.post('/account/delete', ifNoUser401, deleteUserToken, postDeleteAccount);
@@ -162,11 +163,6 @@ function createReadSessionUser(app) {
};
}
function getAccount(req, res) {
const { username } = req.user;
return res.redirect('/' + username);
}
function getUnlinkSocial(req, res, next) {
const { user } = req;
const { username } = user;
+2 -1
View File
@@ -6,7 +6,8 @@ type Endpoints = [string, 'GET' | 'POST'][];
export const endpoints: Endpoints = [
['/refetch-user-completed-challenges', 'POST'],
['/certificate/verify-can-claim-cert', 'GET'],
['/api/github', 'GET']
['/api/github', 'GET'],
['/account', 'GET']
];
export const deprecatedEndpoints: FastifyPluginCallbackTypebox = (