mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-07-06 04:51:44 -07:00
feat: es6+mods
This commit is contained in:
parent
773b64ea30
commit
19c92ed244
19 changed files with 179 additions and 245 deletions
|
@ -1,7 +1,7 @@
|
|||
const express = require("express");
|
||||
import express from "express";
|
||||
const router = express.Router();
|
||||
|
||||
const auth = require("../services/auth");
|
||||
import { authorize } from "../services/auth.js";
|
||||
|
||||
router.get("/login", async function (req, res) {
|
||||
if (process.env.ZU_DISABLE_AUTH === "true") {
|
||||
|
@ -13,7 +13,7 @@ router.get("/login", async function (req, res) {
|
|||
|
||||
router.post("/login", async function (req, res) {
|
||||
if (req.body.username && req.body.password) {
|
||||
auth.authorize(req.body.username, req.body.password, function (err, user) {
|
||||
authorize(req.body.username, req.body.password, function (err, user) {
|
||||
if (user) {
|
||||
res.send({ token: user["token"] });
|
||||
} else {
|
||||
|
@ -27,4 +27,4 @@ router.post("/login", async function (req, res) {
|
|||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
export default router;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue