-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rewrite Ticket component (#277)
Replace storage SDK with REST API.
- Loading branch information
Showing
28 changed files
with
1,617 additions
and
1,285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const AV = require('leancloud-storage') | ||
const { Router } = require('express') | ||
|
||
const { requireAuth, catchError, customerServiceOnly } = require('../middleware') | ||
|
||
const router = Router().use(requireAuth, customerServiceOnly) | ||
|
||
router.get( | ||
'/', | ||
catchError(async (req, res) => { | ||
const role = await new AV.Query(AV.Role).equalTo('name', 'customerService').first() | ||
if (!role) { | ||
res.throw(500, 'Missing customer services role') | ||
} | ||
const customerServices = await role.getUsers().query().find({ useMasterKey: true }) | ||
res.json( | ||
customerServices.map((user) => { | ||
return { | ||
id: user.id, | ||
nid: user.get('nid'), | ||
email: user.get('email') || '', | ||
username: user.get('username'), | ||
name: user.get('name') || '', | ||
category_ids: user.get('categories')?.map((c) => c.objectId) || [], | ||
} | ||
}) | ||
) | ||
}) | ||
) | ||
|
||
module.exports = router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
import React from 'react' | ||
import { render } from 'react-dom' | ||
import { BrowserRouter } from 'react-router-dom' | ||
import { QueryClient, QueryClientProvider } from 'react-query' | ||
|
||
import App from './modules/App' | ||
import './config.webapp' | ||
|
||
const queryClient = new QueryClient({ | ||
defaultOptions: { | ||
queries: { | ||
refetchOnWindowFocus: false, | ||
}, | ||
}, | ||
}) | ||
|
||
render( | ||
<BrowserRouter> | ||
<App /> | ||
<QueryClientProvider client={queryClient}> | ||
<App /> | ||
</QueryClientProvider> | ||
</BrowserRouter>, | ||
document.getElementById('app') | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.