-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
222 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"use server"; | ||
|
||
import { Cookies } from "@/utils/constants"; | ||
import { getUser } from "@midday/supabase/cached-queries"; | ||
import { revalidateTag } from "next/cache"; | ||
import { cookies } from "next/headers"; | ||
import { action } from "./safe-action"; | ||
import { changeChartPeriodSchema } from "./schema"; | ||
|
||
export const changeChartPeriodAction = action( | ||
changeChartPeriodSchema, | ||
async (value) => { | ||
const user = await getUser(); | ||
|
||
cookies().set({ | ||
name: Cookies.ChartPeriod, | ||
value: JSON.stringify(value), | ||
}); | ||
|
||
revalidateTag(`chart_${user.data.team_id}`); | ||
|
||
return value; | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { createClient } from "@vercel/kv"; | ||
|
||
export const client = createClient({ | ||
url: process.env.KV_REST_API_URL, | ||
token: process.env.KV_REST_API_TOKEN, | ||
url: process.env.KV_REST_API_URL!, | ||
token: process.env.KV_REST_API_TOKEN!, | ||
}); |