Skip to content

Commit c42d31d

Browse files
committed
lint: lib/user/index.ts
- add typing annotate
1 parent 87d2328 commit c42d31d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/user/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import archiver from 'archiver'
22
import async from 'async'
3+
import {Request, Response} from "express";
34
import * as response from '../response'
45
import config from '../config'
56
import {Note, User} from '../models'
67
import {logger} from '../logger'
78
import {generateAvatar} from '../letter-avatars'
89

9-
export async function getMe(req, res) {
10+
export async function getMe(req: Request, res: Response): Promise<void> {
1011
if (!req.isAuthenticated()) {
11-
return res.status(401).send({
12+
res.status(401).send({
1213
status: 'forbidden'
1314
})
15+
return
1416
}
1517

1618
const user = await User.findOne({
@@ -32,7 +34,7 @@ export async function getMe(req, res) {
3234
})
3335
}
3436

35-
export async function deleteUser(req, res) {
37+
export async function deleteUser(req: Request, res: Response): Promise<void> {
3638
if (!req.isAuthenticated()) {
3739
return response.errorForbidden(req, res)
3840
}
@@ -55,7 +57,7 @@ export async function deleteUser(req, res) {
5557
return res.redirect(config.serverURL + '/')
5658
}
5759

58-
export function exportMyData(req, res) {
60+
export function exportMyData(req: Request, res: Response): void {
5961
if (!req.isAuthenticated()) {
6062
return response.errorForbidden(req, res)
6163
}
@@ -114,7 +116,7 @@ export function exportMyData(req, res) {
114116
})
115117
}
116118

117-
export function getMyAvatar(req, res) {
119+
export function getMyAvatar(req: Request, res: Response): void {
118120
res.setHeader('Content-Type', 'image/svg+xml')
119121
res.setHeader('Cache-Control', 'public, max-age=86400')
120122
res.send(generateAvatar(req.params.username))

0 commit comments

Comments
 (0)