summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-11-17 15:16:23 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-11-17 15:16:23 +0700
commit07819844d5ef7e323fd956eacfedecb2f4f4bb80 (patch)
treed83ba8c6ff7f47f568889ff8371ee9d9918ed166 /src/common
parent10ce1ad59969576244ba786d7d17da2da3fe6f61 (diff)
Update result feature
Diffstat (limited to 'src/common')
-rw-r--r--src/common/components/Authenticated/index.tsx5
-rw-r--r--src/common/constants/team.ts5
-rw-r--r--src/common/stores/useResultStore.ts10
3 files changed, 16 insertions, 4 deletions
diff --git a/src/common/components/Authenticated/index.tsx b/src/common/components/Authenticated/index.tsx
index cf7086e..3957a8d 100644
--- a/src/common/components/Authenticated/index.tsx
+++ b/src/common/components/Authenticated/index.tsx
@@ -1,10 +1,9 @@
-import { cookies } from 'next/headers'
+import getServerCredential from '@/common/libs/getServerCredential'
import { redirect } from 'next/navigation'
import React from 'react'
const Authenticated = ({ children }: { children: React.ReactNode }) => {
- const credentialStr = cookies().get('credential')?.value
- const credential: Credential | null = credentialStr ? JSON.parse(credentialStr) : null
+ const credential = getServerCredential()
if (!credential) redirect('/login')
diff --git a/src/common/constants/team.ts b/src/common/constants/team.ts
index cfb895b..8daad6a 100644
--- a/src/common/constants/team.ts
+++ b/src/common/constants/team.ts
@@ -1,12 +1,15 @@
import { TeamAliases } from "../types/team";
-export const teamAliases: TeamAliases = {
+export const TEAM_ALIASES: TeamAliases = {
COUNT1: {
name: "Hitung 1",
},
COUNT2: {
name: "Hitung 2",
},
+ COUNT3: {
+ name: "Hitung 3",
+ },
VERIFICATION: {
name: "Verifikasi",
},
diff --git a/src/common/stores/useResultStore.ts b/src/common/stores/useResultStore.ts
index d8da56c..09e8146 100644
--- a/src/common/stores/useResultStore.ts
+++ b/src/common/stores/useResultStore.ts
@@ -1,20 +1,25 @@
import { create } from "zustand";
+import { SelectOption } from "../types/select";
type State = {
filter: {
search: string;
company: string;
+ show: string;
};
+ companies: SelectOption[];
};
type Action = {
updateFilter: (name: string, value: string) => void;
+ setCompanies: (data: SelectOption[]) => void;
};
export const useResultStore = create<State & Action>((set) => ({
filter: {
search: "",
company: "",
+ show: "1",
},
updateFilter: (name, value) =>
set((state) => ({
@@ -23,4 +28,9 @@ export const useResultStore = create<State & Action>((set) => ({
[name]: value,
},
})),
+ companies: [],
+ setCompanies: (data) =>
+ set(() => ({
+ companies: data,
+ })),
}));