Bläddra i källkod

update

tags/Baseline_30082024_FRONTEND_UAT
MSI\derek 1 år sedan
förälder
incheckning
ed66ffebd4
2 ändrade filer med 51 tillägg och 1 borttagningar
  1. +35
    -0
      src/app/api/team/actions.ts
  2. +16
    -1
      src/app/api/team/index.ts

+ 35
- 0
src/app/api/team/actions.ts Visa fil

@@ -2,6 +2,33 @@
import { serverFetchJson } from "@/app/utils/fetchUtil";
import { BASE_API_URL } from "@/config/api";
import { cache } from "react";
import { Staff, StaffGroup } from "../staff";
import { TeamResult } from ".";


export interface CreateTeamInputs {
id: number | null;
// name: string;
// team: string;
// staffId: string;
// grade: string;
// joinPosition: string;
// currentPosition: string;
description: String;
addStaffIds: number[];
deleteStaffIds?: number[];
}

export interface Team {
id: number;
name: string;
}

export interface staff {
id: number;
name: string;
team: Team;
}

export interface comboProp {
id: any;
@@ -17,3 +44,11 @@ export const fetchTeamCombo = cache(async () => {
next: { tags: ["team"] },
});
});

export const saveTeam = async (data: CreateTeamInputs) => {
return serverFetchJson(`${BASE_API_URL}/team/save`, {
method: "POST",
body: JSON.stringify(data),
headers: { "Content-Type": "application/json" },
});
};

+ 16
- 1
src/app/api/team/index.ts Visa fil

@@ -7,14 +7,29 @@ import "server-only";
export interface TeamResult {
action: any;
id: number;
teamId: number;
name: string;
code: string;
description: string;
}
staffId: string;
staffName: string;
posLabel: string;
posCode: string;

}
export const fetchTeam = cache(async () => {
return serverFetchJson<TeamResult[]>(`${BASE_API_URL}/team`, {
next: { tags: ["team"] },
});
});

export const preloadTeamDetail = () => {
fetchTeamDetail();
};

export const fetchTeamDetail = cache(async () => {
return serverFetchJson<TeamResult[]>(`${BASE_API_URL}/team/detail`, {
next: { tags: ["team"] },
});
});

Laddar…
Avbryt
Spara