Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 61bb0cc23c |
@@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Dto;
|
|
||||||
|
|
||||||
class ApiResponseDto
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
public readonly ?string $message = null,
|
|
||||||
// public readonly ?int $statusCode = 200,
|
|
||||||
public readonly mixed $data = null,
|
|
||||||
public readonly mixed $meta = null,
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// return new self($this->message, $this->statusCode, $this->data, $this->meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
// public static function success()
|
|
||||||
// {
|
|
||||||
// return new self($message, $data, $statusCode = 200);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public static function error()
|
|
||||||
// {
|
|
||||||
// return new self($message, $data, $statusCode = 400);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Providers;
|
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
use App\Services\ApiResponder;
|
|
||||||
|
|
||||||
class ApiResponderProvider extends ServiceProvider
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Register services.
|
|
||||||
*/
|
|
||||||
public function register(): void
|
|
||||||
{
|
|
||||||
$this->app->bind(ApiResponder::class, function($app){
|
|
||||||
return new ApiResponder();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bootstrap services.
|
|
||||||
*/
|
|
||||||
public function boot(): void
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Services;
|
|
||||||
|
|
||||||
use App\Dto\ApiResponseDto;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
|
|
||||||
class ApiResponder{
|
|
||||||
public $dto;
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
)
|
|
||||||
{}
|
|
||||||
|
|
||||||
public function success(): JsonResponse
|
|
||||||
{
|
|
||||||
return $this->buildResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function error()
|
|
||||||
{
|
|
||||||
return $this->buildResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setDto(ApiResponseDto $dto)
|
|
||||||
{
|
|
||||||
$this->dto = $dto;
|
|
||||||
}
|
|
||||||
|
|
||||||
// public function fromDTO(ApiResponseDto $dto)
|
|
||||||
// {
|
|
||||||
// return $dto;
|
|
||||||
// }
|
|
||||||
|
|
||||||
#Гаврилов
|
|
||||||
//СБОР СТАТИСТИКИ ПО ВЫЗЫВАЕМЫМ API ЕНДПОИНТАМ. ВНЕСТИ В TODO ПРОЕКТА
|
|
||||||
private function setStatistics()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#Гаврилов
|
|
||||||
//ДОБАВЬ ЛОГИРОВАНИЕ ОШИБОК В TRY CATCH В .LOG ФАЙЛ
|
|
||||||
|
|
||||||
private function buildResponse(): JsonResponse
|
|
||||||
{
|
|
||||||
//echo '<pre>'; var_dump((array)$this->dto); echo'</pre>';
|
|
||||||
//return (array) $this->dto;
|
|
||||||
return response()->json((array) $this->dto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { Button } from '@SharePoint/rencredit_uikit';
|
||||||
|
|
||||||
|
export default function Header(){
|
||||||
|
const[appName, setAppName] = useState<string>('');
|
||||||
|
useEffect( () => {
|
||||||
|
setAppName(document.getElementById('page__header-block')?.dataset.app_name || '');
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="header-block__header-container">
|
||||||
|
<div className="header-container__block">
|
||||||
|
<div>
|
||||||
|
<Button
|
||||||
|
type = 'button'
|
||||||
|
onClick = {() => document.location.href='/public/menu'}
|
||||||
|
text = 'ЛОГОТИП ТУТ'
|
||||||
|
ui = 'secondaryPurple'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Button
|
||||||
|
type = 'button'
|
||||||
|
onClick = {() => document.location.href='/public/menu'}
|
||||||
|
text = 'Меню'
|
||||||
|
ui = 'secondaryPurple'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="header-container__block__app-name">{appName}</div>
|
||||||
|
</div>
|
||||||
|
<div className="header-container__block">
|
||||||
|
<div>
|
||||||
|
<Button
|
||||||
|
type = 'button'
|
||||||
|
onClick = {() => document.location.href='/public/request_access'}
|
||||||
|
text = 'Заказать доступ'
|
||||||
|
ui = 'secondaryPurple'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Button
|
||||||
|
type = 'button'
|
||||||
|
onClick = {() => document.location.href='/public/logout'}
|
||||||
|
text = 'Выход'
|
||||||
|
ui = 'secondaryPurple'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user