Commit 749a6447 authored by chaiwat's avatar chaiwat

Add dashboard

parent 3294b268
......@@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@line/liff": "^2.17.0",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
......@@ -24,12 +22,16 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
<!-- line sdk -->
<script src="https://static.line-scdn.net/liff/edge/2.1/liff.js"></script>
<!-- line sdk -->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
......@@ -39,5 +41,6 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
</body>
</html>
\ No newline at end of file
import { lazy } from 'react'
const PagesRoutes = [
// Dashboard
{
path: '/Dashboard',
component: lazy(() => import('../../view/Dashboards/ecommerce')),
layout: 'VerticalLayout',
}
]
export default PagesRoutes
\ No newline at end of file
// Routes Imports
import Pages from "./Pages";
// Merge Routes
const Routes = [...Pages];
export { Routes };
\ No newline at end of file
import React from 'react'
export default function Ecommerce() {
return (
<div>
<h3>สวัสดี, Fariw 👋</h3>
</div>
)
}
\ No newline at end of file
import liff from "@line/liff";
import { Fragment, useEffect, useState } from "react";
function App() {
return (
<div>
<p>Login</p>
</div>
)
// const [pictureUrl, setPictureUrl] = useState(logo)
// eslint-disable-next-line no-unused-vars
const [idToken, setIdToken] = useState("");
// const [displayName, setDisplayName] = useState('')
// const [statusMessage, setStatusMessage] = useState('')
// const [userId, setUserId] = useState('')
// const logout = () => {
// liff.logout()
// window.location.reload()
// }
const initLine = () => {
liff.init(
{ liffId: "1656654849-0gQezROW" },
() => {
if (liff.isLoggedIn()) {
runApp();
} else {
liff.login();
}
},
(err) => console.error(err)
);
};
const runApp = () => {
const idToken = liff.getIDToken();
setIdToken(idToken);
liff
.getProfile()
.then((profile) => {
console.log(profile)
setTimeout(() => {
window.location.href = '/Dashboard'
}, 3000);
})
.catch((err) => console.error(err));
};
useEffect(() => {
initLine();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return (
<Fragment></Fragment>
);
}
export default App
\ No newline at end of file
export default App;
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment