generated from Cmosley/mern-jwt-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintcache
1 lines (1 loc) · 6.65 KB
/
.eslintcache
1
[{"/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/index.js":"1","/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/serviceWorker.js":"2","/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/pages/App/App.jsx":"3","/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/services/authService.js":"4","/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/pages/Login/Login.jsx":"5","/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/pages/Signup/Signup.jsx":"6","/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/components/NavBar/NavBar.jsx":"7","/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/pages/Users/Users.jsx":"8","/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/services/tokenService.js":"9","/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/services/userService.js":"10","/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/components/SignupForm/SignupForm.jsx":"11"},{"size":663,"mtime":1610322563820,"results":"12","hashOfConfig":"13"},{"size":5086,"mtime":1610322563822,"results":"14","hashOfConfig":"13"},{"size":1445,"mtime":1610322563821,"results":"15","hashOfConfig":"13"},{"size":1118,"mtime":1610322563822,"results":"16","hashOfConfig":"13"},{"size":1591,"mtime":1610323101553,"results":"17","hashOfConfig":"13"},{"size":443,"mtime":1610322563821,"results":"18","hashOfConfig":"13"},{"size":848,"mtime":1610322563820,"results":"19","hashOfConfig":"13"},{"size":490,"mtime":1610322563822,"results":"20","hashOfConfig":"13"},{"size":726,"mtime":1610322563822,"results":"21","hashOfConfig":"13"},{"size":285,"mtime":1610322563823,"results":"22","hashOfConfig":"13"},{"size":2216,"mtime":1610322563820,"results":"23","hashOfConfig":"13"},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},"mg36l4",{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},{"filePath":"31","messages":"32","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"33","usedDeprecatedRules":"26"},{"filePath":"34","messages":"35","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"36","messages":"37","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},{"filePath":"38","messages":"39","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},{"filePath":"40","messages":"41","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},{"filePath":"42","messages":"43","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"44","usedDeprecatedRules":"26"},{"filePath":"45","messages":"46","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},{"filePath":"47","messages":"48","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/index.js",[],["49","50"],"/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/serviceWorker.js",[],"/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/pages/App/App.jsx",[],"/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/services/authService.js",["51"],"import tokenService from \"./tokenService\";\n\nconst BASE_URL = '/api/auth/';\n\nfunction signup(user) {\n return fetch(BASE_URL + 'signup', {\n method: 'POST',\n headers: new Headers({'Content-Type': 'application/json'}),\n body: JSON.stringify(user)\n })\n .then(res => {\n console.log(res, '<-- response object')\n return res.json();\n })\n .then(json => {\n if(json.token) return json;\n console.log(json, '<-- the error')\n throw new Error(`${json.err}`)\n })\n .then(({ token }) => {\n tokenService.setToken(token);\n })\n}\n\nfunction getUser() {\n return tokenService.getUserFromToken();\n}\n\nfunction logout() {\n tokenService.removeToken();\n}\n\nfunction login(creds) {\n return fetch(BASE_URL + \"login\", {\n method: \"POST\",\n headers: new Headers({ \"Content-Type\": \"application/json\" }),\n body: JSON.stringify(creds),\n })\n .then((res) => {\n // Valid login if we have a status of 2xx (res.ok)\n if (res.ok) return res.json();\n throw new Error(\"Bad Credentials!\");\n })\n .then(({ token }) => tokenService.setToken(token));\n}\n\nexport default {\n signup,\n getUser,\n logout,\n login,\n};","/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/pages/Login/Login.jsx",[],"/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/pages/Signup/Signup.jsx",[],"/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/components/NavBar/NavBar.jsx",[],"/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/pages/Users/Users.jsx",[],"/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/services/tokenService.js",["52"],"function setToken(token) {\n localStorage.setItem(\"token\", token);\n}\n\nfunction getToken() {\n let token = localStorage.getItem(\"token\");\n if (token) {\n // Check if expired, remove if it is\n const payload = JSON.parse(atob(token.split(\".\")[1]));\n // JWT's exp is expressed in seconds, not milliseconds, so convert\n if (payload.exp < Date.now() / 1000) {\n localStorage.removeItem(\"token\");\n token = null;\n }\n }\n return token;\n}\n\nfunction getUserFromToken() {\n const token = getToken();\n return token ? JSON.parse(atob(token.split(\".\")[1])).user : null;\n}\n\nfunction removeToken() {\n localStorage.removeItem(\"token\");\n}\n\nexport default {\n setToken,\n getToken,\n getUserFromToken,\n removeToken,\n};","/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/services/userService.js",[],"/Users/david/Dropbox/code/ga/sei/lectures/mern-jwt-template/src/components/SignupForm/SignupForm.jsx",[],{"ruleId":"53","replacedBy":"54"},{"ruleId":"55","replacedBy":"56"},{"ruleId":"57","severity":1,"message":"58","line":47,"column":1,"nodeType":"59","endLine":52,"endColumn":3},{"ruleId":"57","severity":1,"message":"58","line":28,"column":1,"nodeType":"59","endLine":33,"endColumn":3},"no-native-reassign",["60"],"no-negated-in-lhs",["61"],"import/no-anonymous-default-export","Assign object to a variable before exporting as module default","ExportDefaultDeclaration","no-global-assign","no-unsafe-negation"]