|
|
@@ -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" }, |
|
|
|
}); |
|
|
|
}; |