diff --git a/lib/core/utilities.js b/lib/core/utilities.js index 55522a915..9ddb554d4 100644 --- a/lib/core/utilities.js +++ b/lib/core/utilities.js @@ -25,7 +25,7 @@ export const encodeQuery = queryObject => { .join('&') } -export const randomString = () => btoa(Math.random() + '').replace('==', '') +export const randomString = () => (process.browser ? btoa(Math.random() + '') : Buffer.from(Math.random() + '').toString('base64')).replace('==', '') export const routeOption = (route, key, value) => { return route.matched.some(m => {