Skip to content

Commit

Permalink
Completed
Browse files Browse the repository at this point in the history
  • Loading branch information
acehood0126 committed May 11, 2022
0 parents commit 85d006f
Show file tree
Hide file tree
Showing 82 changed files with 10,925 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/server/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel
9 changes: 9 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteRule ^$ http://127.0.0.1:3000/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:3000/$1 [P,L]

</IfModule>
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
31 changes: 31 additions & 0 deletions api/AuthApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

import BaseApi from './BaseApi';

class AuthApi extends BaseApi {

signin(address, signature) {
return this.instance.post(
"/api/auth/signin", { address, signature }
);
}

checkJwt(address, jwt) {
return this.instance.post(
"/api/auth/check-jwt", { address },
{
headers: {
'Authorization': `Bearer ${jwt}`
}
}
);
}

getNonce(address) {
return this.instance.post(
"/api/auth/get-nonce", { address }
);
}

}

export default new AuthApi();
50 changes: 50 additions & 0 deletions api/BaseApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import axios, { AxiosInstance, AxiosRequestConfig } from "axios";

export default class BaseApi {
constructor() {
this.instance = axios.create({
baseURL: process.env.NEXT_PUBLIC_SERVER_URL ? process.env.NEXT_PUBLIC_SERVER_URL : ''
});

this.instance.interceptors.request.use(
(config) => {
// Do something before request is sent
const token = this.getToken()
if(config.headers && token !== '')
config.headers["Authorization"] = "bearer " + token;
return config;
},
error => {
Promise.reject(error);
}
);

this.instance.interceptors.response.use(
(response) => {
return response;
},
async (error) => {
if (error.response.status === 401) {
const refreshToken = localStorage.getItem('refreshToken');
if(refreshToken != null) {
// const response = await this.refreshAuthToken(refreshToken);

// store.commit('login', response.data);
// this.setAuthToken(response.data.token);
// error.config.headers['Authorization'] = `bearer ${response.data.token}`;
}
else {
// store.commit('logout');
}
return axios(error.config);
} else {
return Promise.reject(error);
}
}
);
}

getToken() {
return localStorage.getItem('jwt');
}
}
47 changes: 47 additions & 0 deletions api/ProposalApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

import BaseApi from './BaseApi';

class ProposalApi extends BaseApi {

listProposal() {
return this.instance.get(
"/api/proposal"
);
}

getProposal(id) {
return this.instance.get(
`/api/proposal/${id}`
);
}

createProposal(address, title, description) {
return this.instance.post(
`/api/proposal`, {
address, title, description
}
);
}

vote(id, address, vote) {
return this.instance.post(
`/api/proposal/${id}/vote`, {
address, vote
}
);
}

getRecentPassed() {
return this.instance.get(
`/api/proposal/recent-passed`
);
}

getRemainingTimeForNext() {
return this.instance.get(
`/api/proposal/remain-time`
);
}
}

export default new ProposalApi();
Binary file added assets/image/avatar-me.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image/bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image/deco01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image/deco02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image/deco03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image/hero.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions assets/image/proposal-icon-01.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions assets/image/proposal-icon-02.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 85d006f

Please sign in to comment.