You've already forked isop-mirror
refactor: change API endpoint for getting student's personal internships
This commit is contained in:
@@ -10,7 +10,7 @@ use Illuminate\Http\Request;
|
||||
|
||||
class InternshipController extends Controller
|
||||
{
|
||||
public function all()
|
||||
public function all_student()
|
||||
{
|
||||
$internships = Internship::where('user_id', auth()->id())->get()->makeHidden(['created_at', 'updated_at']);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ Route::post('/password-reset', [RegisteredUserController::class, 'reset_password
|
||||
|
||||
Route::prefix('/internships')->group(function () {
|
||||
Route::get("/", [InternshipController::class, 'all'])->name("api.internships");
|
||||
Route::get("/my", [InternshipController::class, 'all_student'])->name("api.internships.student");
|
||||
|
||||
Route::middleware("auth:sanctum")->group(function () {
|
||||
Route::put("/new", [InternshipController::class, 'store'])->name("api.internships.create");
|
||||
|
||||
@@ -25,7 +25,7 @@ const headers = [
|
||||
];
|
||||
|
||||
const user = useSanctumUser<User>();
|
||||
const { data, error } = await useSanctumFetch<Internship[]>('/api/internships');
|
||||
const { data, error } = await useSanctumFetch<Internship[]>('/api/internships/my');
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user