mirror of
https://github.com/IT4Change/ohmyform-ui.git
synced 2025-12-13 09:45:50 +00:00
fix lint and add changelog
This commit is contained in:
parent
39c8296c61
commit
78cadf0942
@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- do not show login note if it is not set
|
||||
- typo in dropdown options https://github.com/ohmyform/ohmyform/issues/96
|
||||
- query parms are not parsed https://github.com/ohmyform/ui/pull/27 https://github.com/ohmyform/ohmyform/issues/100
|
||||
- errors because of missing user reference (https://github.com/ohmyform/ohmyform/issues/102)
|
||||
|
||||
### Security
|
||||
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
import React from 'react';
|
||||
import {useRouter as useNextRouter} from 'next/router';
|
||||
import { NextRouter, useRouter as useNextRouter } from 'next/router'
|
||||
|
||||
const parseQuery = (path) => {
|
||||
const query = {}
|
||||
const regex = /[?&]([^&$=]+)(=([^&$]+))?/g
|
||||
let param: RegExpExecArray
|
||||
|
||||
function parseQuery(path) {
|
||||
const query = {};
|
||||
const regex = /[?&]([^&$=]+)(=([^&$]+))?/g;
|
||||
let param;
|
||||
while ((param = regex.exec(path)) !== null) {
|
||||
query[decodeURIComponent(param[1])] = decodeURIComponent(param[3]);
|
||||
query[decodeURIComponent(param[1])] = decodeURIComponent(param[3])
|
||||
}
|
||||
return query;
|
||||
|
||||
return query
|
||||
}
|
||||
|
||||
export function useRouter() {
|
||||
const router = useNextRouter();
|
||||
router.query = {...router.query, ...parseQuery(router.asPath)};
|
||||
return router;
|
||||
export const useRouter = (): NextRouter => {
|
||||
const router = useNextRouter()
|
||||
router.query = { ...router.query, ...parseQuery(router.asPath) }
|
||||
return router
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user