generated from devx-agency-deprecated/devx-next-js-starterpack
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from TomaszPilch/TECH-add-dynamic-translation-s…
…upport Tech add dynamic translation support
- Loading branch information
Showing
20 changed files
with
2,936 additions
and
2,650 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
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 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,30 +1,3 @@ | ||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction | ||
import axios from 'axios' | ||
const loginRoute = require('@bheui/server-functions/lib/login/login') | ||
|
||
const axiosLoginInstance = axios.create({ | ||
baseURL: `${process.env.API_URL}/api/v1`, | ||
timeout: 100000, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}) | ||
|
||
export default (req, res) => { | ||
const formData = encodeURI( | ||
`username=${req.body.email}&password=${req.body.password}&client_id=${process.env.CLIENT_ID}&client_secret=${process.env.CLIENT_SECRET}&grant_type=password`, | ||
) | ||
axiosLoginInstance | ||
.post('/oauth/token', formData, { | ||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, | ||
}) | ||
.then((response) => { | ||
res.statusCode = 200 | ||
res.setHeader('Content-Type', 'application/json') | ||
res.end(JSON.stringify(response.data)) | ||
}) | ||
.catch((e) => { | ||
res.statusCode = 400 | ||
res.setHeader('Content-Type', 'application/json') | ||
res.end(JSON.stringify(e.message)) | ||
}) | ||
} | ||
module.exports = loginRoute |
File renamed without changes.
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 @@ | ||
{"loginScreen":{"signIn":"Sign In","remember":"Remember","submitButton":"Submit"},"general":{"email":"Email","password":"Password","login":"Login"},"validationErrors":{"required":"This value is required.","badFormat":"Value format is not valid.","tooShort":"This value is to short, min. length is {{length}}.","tooLong":"This value is to long, max. length is {{length}}.","badPhoneFormat":"This phone number is not valid.","email":"Invalid email address format.","cardNumber":"Card number is not valid.","range":"The value must be in range from {{start}} to {{end}}.","numeric":"Value must be numeric.","integer":"Value must be an integer.","badRegExp":"Bad format! Pattern: {{pattern}}","suffix_interval":"(1){ 1 other error };(2-inf){ {{count}} other errors};"}} |
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
Empty file.
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const { exec } = require('child_process') | ||
|
||
const runCommand = (cmd) => { | ||
exec(cmd, (e, stdout, stderr) => { | ||
console.log(e) | ||
console.log(stdout) | ||
console.log(stderr) | ||
}) | ||
} | ||
|
||
runCommand('cd node_modules/react & yarn unlink') | ||
runCommand('cd node_modules/react-redux & yarn unlink') | ||
runCommand('cd node_modules/next & yarn unlink') | ||
runCommand('cd node_modules/@fluentui/react & yarn unlink') | ||
runCommand('cd node_modules/@uifabric/experiments & yarn unlink') | ||
runCommand('cd node_modules/office-ui-fabric-core & yarn unlink') | ||
runCommand('cd node_modules/office-ui-fabric-react & yarn unlink') | ||
runCommand('cd node_modules/react & yarn unlink') | ||
runCommand('cd node_modules/react-dom & yarn unlink') |
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,19 @@ | ||
const { exec } = require('child_process') | ||
|
||
const runCommand = (cmd) => { | ||
exec(cmd, (e, stdout, stderr) => { | ||
console.log(e) | ||
console.log(stdout) | ||
console.log(stderr) | ||
}) | ||
} | ||
|
||
runCommand('cd node_modules/react & yarn link') | ||
runCommand('cd node_modules/react-redux & yarn link') | ||
runCommand('cd node_modules/next & yarn link') | ||
runCommand('cd node_modules/@fluentui/react & yarn link') | ||
runCommand('cd node_modules/@uifabric/experiments & yarn link') | ||
runCommand('cd node_modules/office-ui-fabric-core & yarn link') | ||
runCommand('cd node_modules/office-ui-fabric-react & yarn link') | ||
runCommand('cd node_modules/react & yarn link') | ||
runCommand('cd node_modules/react-dom & yarn link') |
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,55 @@ | ||
const express = require('express') | ||
const next = require('next') | ||
const compression = require('compression') | ||
const bodyParser = require('body-parser') | ||
|
||
const processLocale = require('@bheui/server-functions/lib/locale/process-locale') | ||
|
||
const apiLogin = require('./pages/api/login').default | ||
|
||
const dev = process.env.NODE_ENV !== 'production' | ||
const app = next({ dev }) | ||
const handle = app.getRequestHandler() | ||
|
||
const renderPageOrContinue = (req, res, nextCl) => { | ||
if (req.path.includes('_next') || req.path.includes('api/')) { | ||
return nextCl() | ||
} | ||
const query = { ...req.params } | ||
if (req.params.id) { | ||
query.page = '/[module]/[action]/[id]' | ||
} else if (req.params.action) { | ||
query.page = '/[module]/[action]' | ||
} else if (req.params.module) { | ||
query.page = '/[module]' | ||
} | ||
return app.render(req, res, req.path, query) | ||
} | ||
|
||
app.prepare().then(async () => { | ||
await processLocale() | ||
|
||
const server = express() | ||
server.use(`/static`, express.static('public')) | ||
server.use(compression()) | ||
|
||
server.get('/is-ready', (req, res) => { | ||
res.sendStatus(200) | ||
}) | ||
|
||
server.use('/api/login', bodyParser.json({ limit: '50mb' })) | ||
server.post('/api/login', apiLogin) | ||
|
||
server.get('/:module/:action/:id', renderPageOrContinue, (req, res) => handle(req, res)) | ||
server.get('/:module/:action', renderPageOrContinue, (req, res) => handle(req, res)) | ||
|
||
server.get('*', (req, res) => handle(req, res)) | ||
|
||
server.listen(3000, (err) => { | ||
if (err) { | ||
console.error(err.stack) | ||
process.exit(1) | ||
} | ||
console.log(`> Ready on http://localhost:${3000}`) | ||
}) | ||
}) |
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
Oops, something went wrong.