mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-01 03:46:25 +02:00
feat: added incentive credits system
This commit is contained in:
parent
d45b33e776
commit
39d65d6166
27 changed files with 587 additions and 84 deletions
29
surfsense_web/lib/apis/incentive-tasks-api.service.ts
Normal file
29
surfsense_web/lib/apis/incentive-tasks-api.service.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import {
|
||||
type CompleteTaskResponse,
|
||||
completeTaskResponse,
|
||||
type GetIncentiveTasksResponse,
|
||||
getIncentiveTasksResponse,
|
||||
type IncentiveTaskTypeEnum,
|
||||
} from "@/contracts/types/incentive-tasks.types";
|
||||
import { baseApiService } from "./base-api.service";
|
||||
|
||||
class IncentiveTasksApiService {
|
||||
/**
|
||||
* Get all available incentive tasks with completion status
|
||||
*/
|
||||
getTasks = async (): Promise<GetIncentiveTasksResponse> => {
|
||||
return baseApiService.get("/api/v1/incentive-tasks", getIncentiveTasksResponse);
|
||||
};
|
||||
|
||||
/**
|
||||
* Mark a task as completed and receive page reward
|
||||
*/
|
||||
completeTask = async (taskType: IncentiveTaskTypeEnum): Promise<CompleteTaskResponse> => {
|
||||
return baseApiService.post(
|
||||
`/api/v1/incentive-tasks/${taskType}/complete`,
|
||||
completeTaskResponse
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export const incentiveTasksApiService = new IncentiveTasksApiService();
|
||||
Loading…
Add table
Add a link
Reference in a new issue