PHP Classes

File: frontend/src/services/auth.ts

Recommend this page to a friend!
  Classes of Edward Paul   Task List   frontend/src/services/auth.ts   Download  
File: frontend/src/services/auth.ts
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Task List
Manage and share a list of tasks
Author: By
Last change:
Date: 10 days ago
Size: 983 bytes
 

Contents

Class file image Download
import api from './api'; // Response Types type ProfileResponse = { data: { id: number; username: string; name: string; email: string; }; }; type RegisterResponse = { data: { id: number; username: string; name: string; email: string; token: string; }; }; type RegisterRequest = { name: string; username: string; email: string; password: string; password_confirmation: string; }; type LoginRequest = { email: string; password: string; }; export const login = (data: LoginRequest): Promise<{ token: string }> => { return api.post('/login', data); }; export const register = (data: RegisterRequest): Promise<RegisterResponse> => { return api.post('/register', data); }; export const logout = (): Promise<{ message: string }> => { return api.post('/logout'); }; export const profile = (): Promise<ProfileResponse> => { return api.get('/me'); };