mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-04-20 03:55:54 +00:00
worked on response.ts
- renamed unused arguments to '_' - fixed noteUtil call - moved export of response to the end of the file Signed-off-by: Philip Molares <philip.molares@udo.edu> Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
parent
57675265fc
commit
6601ac76b5
1 changed files with 15 additions and 11 deletions
|
@ -3,7 +3,7 @@ import { Note, User } from './models'
|
|||
|
||||
import fs from 'fs'
|
||||
|
||||
import {logger} from './logger'
|
||||
import { logger } from './logger'
|
||||
|
||||
import { NoteUtils } from './web/note/util'
|
||||
|
||||
|
@ -12,13 +12,8 @@ import errors from './errors'
|
|||
import path from 'path'
|
||||
|
||||
import request from 'request'
|
||||
export const response = {
|
||||
showIndex: showIndex,
|
||||
githubActions: githubActions,
|
||||
gitlabActions: gitlabActions
|
||||
}
|
||||
|
||||
function showIndex (req, res, next) {
|
||||
function showIndex (req, res, _): void {
|
||||
const authStatus = req.isAuthenticated()
|
||||
const deleteToken = ''
|
||||
|
||||
|
@ -54,8 +49,11 @@ function githubActionGist (req, res, note: Note): void {
|
|||
if (!code || !state) {
|
||||
return errors.errorForbidden(res)
|
||||
} else {
|
||||
// This is the way the github api works, therefore we can't change it to camelcase
|
||||
const data = {
|
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
client_id: config.github.clientID,
|
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
client_secret: config.github.clientSecret,
|
||||
code: code,
|
||||
state: state
|
||||
|
@ -105,7 +103,7 @@ function githubActionGist (req, res, note: Note): void {
|
|||
}
|
||||
}
|
||||
|
||||
function githubActions (req, res, next): void {
|
||||
function githubActions (req, res, _): void {
|
||||
const noteId = req.params.noteId
|
||||
NoteUtils.findNoteOrCreate(req, res, function (note: Note) {
|
||||
const action = req.params.action
|
||||
|
@ -120,7 +118,7 @@ function githubActions (req, res, next): void {
|
|||
})
|
||||
}
|
||||
|
||||
function gitlabActionProjects (req, res, note): void {
|
||||
function gitlabActionProjects (req, res, _): void {
|
||||
if (req.isAuthenticated()) {
|
||||
User.findOne({
|
||||
where: {
|
||||
|
@ -163,9 +161,9 @@ function gitlabActionProjects (req, res, note): void {
|
|||
}
|
||||
}
|
||||
|
||||
function gitlabActions (req, res, next): void {
|
||||
function gitlabActions (req, res, _): void {
|
||||
const noteId = req.params.noteId
|
||||
noteUtil.findNote(req, res, function (note) {
|
||||
NoteUtils.findNoteOrCreate(req, res, function (note) {
|
||||
const action = req.params.action
|
||||
switch (action) {
|
||||
case 'projects':
|
||||
|
@ -177,3 +175,9 @@ function gitlabActions (req, res, next): void {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const response = {
|
||||
showIndex: showIndex,
|
||||
githubActions: githubActions,
|
||||
gitlabActions: gitlabActions
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue