Commit 5f030cb0 authored by tykayn's avatar tykayn
Browse files

try stuff to debug the admin page

parent b4f496b0
Pipeline #352521 failed with stage
in 1 minute and 13 seconds
......@@ -18,6 +18,8 @@ export class PollService implements Resolve<Poll> {
private _poll: BehaviorSubject<Poll | undefined> = new BehaviorSubject<Poll | undefined>(undefined);
public readonly poll: Observable<Poll | undefined> = this._poll.asObservable();
redirectToAdministrationAuto = false;
constructor(
private router: Router,
private apiService: ApiService,
......@@ -29,18 +31,20 @@ export class PollService implements Resolve<Poll> {
public async resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<Poll> {
const segments: string[] = state.url.split('/');
const wantedSlug: string = segments.includes('poll') ? segments[segments.indexOf('poll') + 1] : '';
if (!wantedSlug && state.url.includes('administration')) {
if (!wantedSlug && state.url.includes('administration') && this.redirectToAdministrationAuto) {
// creation of new poll
const poll = new Poll(this.userService.getCurrentUser(), this.uuidService.getUUID(), '');
this._poll.next(poll);
this.router.navigate(['poll/' + poll.slug + '/administration']);
const redirectionUrl = 'poll/' + poll.slug + '/administration';
console.log('redirectionUrl', redirectionUrl);
this.router.navigate([redirectionUrl]);
}
if (!this._poll.getValue() || !this._poll.getValue().slug || this._poll.getValue().slug !== wantedSlug) {
await this.loadPollBySlug(wantedSlug);
}
if (this._poll.getValue()) {
return this._poll.getValue();
} else {
} else if (this.redirectToAdministrationAuto) {
this.router.navigate(['page-not-found']);
return;
}
......
export const endpointsV1 = {
polls: {
name: '/polls',
choices: {
name: '/choices',
},
comments: {
name: '/comments',
},
slugs: {
name: '/slugs',
},
answers: {
name: '/answers',
},
},
users: {
name: '/users',
polls: {
name: '/polls',
sendEmail: {
name: '/send-email',
},
},
},
};
const backendApiUrlsInDev = {
local: '/api/v1',
remote: 'https://framadate-api.cipherbliss.com/api/v1',
remote: 'https://framadate-api.cipherbliss.com/api/v1', // customize this URL to your own backend domain
};
import * as endpointsV1 from './api/v1';
export const environment = {
production: true,
appTitle: 'FramaDate',
appLogo: '/assets/img/logo.png',
appTitle: 'FramaDate', // title appears in the top bar
appLogo: '/assets/img/logo.png', // logo appears in the top bar
api: {
baseHref: backendApiUrlsInDev.remote,
endpoints: {
......
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
import * as prodEnv from './environment.prod';
import { endpointsV1 } from './api/v1';
const backendApiUrlsInDev = {
local: '/api/v1',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment