mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-30 18:09:40 +05:00
refactor: change API proxy from Serverless Functions to Serverless Middlewares to save Function Invocations on vercel
This commit is contained in:
parent
11343eb7f8
commit
ad1c56f593
9 changed files with 81 additions and 60 deletions
|
@ -1,6 +1,7 @@
|
|||
"use client";
|
||||
import { create } from "zustand";
|
||||
import { getJWT, removeJWT, fetchDataViaGet } from "#/api/utils";
|
||||
import { ENDPOINTS } from "#/api/config";
|
||||
|
||||
interface userState {
|
||||
_hasHydrated: boolean;
|
||||
|
@ -44,7 +45,7 @@ export const useUserStore = create<userState>((set, get) => ({
|
|||
if (jwt) {
|
||||
const _checkAuth = async () => {
|
||||
const data = await fetchDataViaGet(
|
||||
`/api/profile/${jwt.user_id}?token=${jwt.jwt}`
|
||||
`${ENDPOINTS.user.profile}/${jwt.user_id}?token=${jwt.jwt}`
|
||||
);
|
||||
if (data && data.is_my_profile) {
|
||||
get().login(data.profile, jwt.jwt);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue