From c978df3bf88981af85fc1007ae6435e8cf5ecd0c Mon Sep 17 00:00:00 2001 From: MarkCherepovskyi Date: Sun, 24 Mar 2024 08:02:31 +0200 Subject: [PATCH] jwt --- package.json | 1 + src/common/Optionitem.vue | 6 +- src/common/VoteCard.vue | 57 ++++++++++++- src/common/VoteCardList.vue | 18 +++- src/common/modals/QrAuthModal.vue | 9 +- src/helpers/vote.helpers.ts | 32 ++++--- src/localization/resources/en.json | 5 ++ src/pages/Home.vue | 24 ++++-- src/pages/Vote.vue | 130 +++++++++++++++-------------- src/router/index.ts | 1 + src/types/api.types.ts | 9 +- src/types/vote.types.ts | 19 ++--- yarn.lock | 12 +++ 13 files changed, 208 insertions(+), 115 deletions(-) diff --git a/package.json b/package.json index 23092fa..3f2b0d3 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "rsc": "node scripts/release-sanity-check.mjs" }, "dependencies": { + "@big-whale-labs/poseidon": "^0.0.5", "@distributedlab/fetcher": "^1.0.0-rc.14", "@distributedlab/jac": "^1.0.0-rc.14", "@distributedlab/tools": "^1.0.0-rc.4", diff --git a/src/common/Optionitem.vue b/src/common/Optionitem.vue index c718ab3..ad2bd4c 100644 --- a/src/common/Optionitem.vue +++ b/src/common/Optionitem.vue @@ -1,12 +1,12 @@ + + + +.vote-card__payload { + display: grid; +} + diff --git a/src/common/VoteCardList.vue b/src/common/VoteCardList.vue index e30858a..90c0e41 100644 --- a/src/common/VoteCardList.vue +++ b/src/common/VoteCardList.vue @@ -1,15 +1,29 @@ diff --git a/src/router/index.ts b/src/router/index.ts index bd38bbf..ab539d6 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -22,6 +22,7 @@ const routes: Array = [ path: '/vote/:id', name: ROUTE_NAMES.vote, component: () => import('@/pages/Vote.vue'), + props: true, }, ] diff --git a/src/types/api.types.ts b/src/types/api.types.ts index 65da231..fedc551 100644 --- a/src/types/api.types.ts +++ b/src/types/api.types.ts @@ -14,11 +14,6 @@ export type JsonApiRecordBase = { relationship_names?: JsonApiRelationships } -export type VotingListResponse = JsonApiRecordBase<'vote'> & - Voting[] & - VoteOptions +export type VotingListResponse = JsonApiRecordBase<'vote'> & Voting[] -export type VotingResponse = JsonApiRecordBase<'vote'> & - JsonApiRecord & - Voting & - VoteOptions +export type VotingResponse = JsonApiRecordBase<'vote'> & Voting diff --git a/src/types/vote.types.ts b/src/types/vote.types.ts index a57ab61..513c275 100644 --- a/src/types/vote.types.ts +++ b/src/types/vote.types.ts @@ -5,29 +5,20 @@ export type VotePayload = { export type Voting = { name: string + id: string description: string createdAt: string activeUntil: string + options: VoteOptions[] } export type VoteOptions = { - included: [ - { - id: string - type: string - attributes: { - name: string - voting_id: string - } - }, - ] -} - -export type VoteOption = { id: string type: string attributes: { + id: number name: string - voting_id: string + points: number + votingId: string } } diff --git a/yarn.lock b/yarn.lock index 97275a5..340e765 100644 --- a/yarn.lock +++ b/yarn.lock @@ -35,6 +35,13 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.1.tgz#1e416d3627393fab1cb5b0f2f1796a100ae9133a" integrity sha512-Zo9c7N3xdOIQrNip7Lc9wvRPzlRtovHVE4lkz8WEDr7uYh/GMQhSiIgFxGIArRHYdJE5kxtZjAf8rT0xhdLCzg== +"@big-whale-labs/poseidon@^0.0.5": + version "0.0.5" + resolved "https://registry.yarnpkg.com/@big-whale-labs/poseidon/-/poseidon-0.0.5.tgz#38aee33760bf7a532c570cbbe572e35d9a577f26" + integrity sha512-Gen4qMrQl85tXg1VWBFaqUS3KylqYPoQOMy5OzQjcDTfazbUyxuB0fNVOVavKg1L2nkoF2zqQoQgPIiySuOTag== + dependencies: + big-integer "^1.6.51" + "@csstools/css-parser-algorithms@^2.3.1": version "2.6.1" resolved "https://registry.yarnpkg.com/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.6.1.tgz#c45440d1efa2954006748a01697072dae5881bcd" @@ -874,6 +881,11 @@ base@^0.11.1: mixin-deep "^1.2.0" pascalcase "^0.1.1" +big-integer@^1.6.51: + version "1.6.52" + resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.52.tgz#60a887f3047614a8e1bffe5d7173490a97dc8c85" + integrity sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg== + big.js@^5.2.2: version "5.2.2" resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"